Skip to content

Commit

Permalink
s/MessageType.GAME_INFO/MessageType.CHAT/g
Browse files Browse the repository at this point in the history
  • Loading branch information
Hadron67 committed Jun 23, 2021
1 parent 90f4590 commit 0a48848
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
18 changes: 9 additions & 9 deletions src/main/java/com/hadroncfy/sreplay/command/SReplayCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private static int removeMarker(CommandContext<ServerCommandSource> ctx){
return 1;
}
p.getRecorder().removeMarker(id);
src.getMinecraftServer().getPlayerManager().broadcastChatMessage(render(SReplayMod.getFormats().markerRemoved, ctx.getSource().getName(), name, Integer.toString(id + 1)), MessageType.GAME_INFO, getSenderUUID(ctx));
src.getMinecraftServer().getPlayerManager().broadcastChatMessage(render(SReplayMod.getFormats().markerRemoved, ctx.getSource().getName(), name, Integer.toString(id + 1)), MessageType.CHAT, getSenderUUID(ctx));
}
return 0;
}
Expand Down Expand Up @@ -199,7 +199,7 @@ private static int startServer(CommandContext<ServerCommandSource> ctx){
final ChannelFuture ch = SReplayMod.getServer().bind(SReplayMod.getConfig().serverListenAddress, SReplayMod.getConfig().serverPort);
ch.addListener(future -> {
if (future.isSuccess()){
server.getPlayerManager().broadcastChatMessage(SReplayMod.getFormats().serverStarted, MessageType.GAME_INFO, getSenderUUID(ctx));
server.getPlayerManager().broadcastChatMessage(SReplayMod.getFormats().serverStarted, MessageType.CHAT, getSenderUUID(ctx));
}
else {
src.sendError(render(SReplayMod.getFormats().serverStartFailed, future.cause().getMessage()));
Expand All @@ -218,7 +218,7 @@ private static int stopServer(CommandContext<ServerCommandSource> ctx){
final ChannelFuture ch = SReplayMod.getServer().stop();
ch.addListener(future -> {
if (future.isSuccess()){
server.getPlayerManager().broadcastChatMessage(SReplayMod.getFormats().serverStopped, MessageType.GAME_INFO, getSenderUUID(ctx));
server.getPlayerManager().broadcastChatMessage(SReplayMod.getFormats().serverStopped, MessageType.CHAT, getSenderUUID(ctx));
}
else {
src.sendError(render(SReplayMod.getFormats().serverStopFailed, future.cause().getMessage()));
Expand Down Expand Up @@ -276,7 +276,7 @@ public static int marker(CommandContext<ServerCommandSource> ctx){
if (p != null){
String name = StringArgumentType.getString(ctx, "marker");
p.getRecorder().addMarker(name);
ctx.getSource().getMinecraftServer().getPlayerManager().broadcastChatMessage(render(SReplayMod.getFormats().markerAdded, ctx.getSource().getName(), p.getGameProfile().getName(), name), MessageType.GAME_INFO, getSenderUUID(ctx));
ctx.getSource().getMinecraftServer().getPlayerManager().broadcastChatMessage(render(SReplayMod.getFormats().markerAdded, ctx.getSource().getName(), p.getGameProfile().getName(), name), MessageType.CHAT, getSenderUUID(ctx));
return 1;
}
else {
Expand All @@ -288,7 +288,7 @@ public static int pause(CommandContext<ServerCommandSource> ctx){
Photographer p = requirePlayer(ctx);
if (p != null){
p.setPaused(true);
ctx.getSource().getMinecraftServer().getPlayerManager().broadcastChatMessage(render(SReplayMod.getFormats().recordingPaused, ctx.getSource().getName(), p.getGameProfile().getName()), MessageType.GAME_INFO, getSenderUUID(ctx));
ctx.getSource().getMinecraftServer().getPlayerManager().broadcastChatMessage(render(SReplayMod.getFormats().recordingPaused, ctx.getSource().getName(), p.getGameProfile().getName()), MessageType.CHAT, getSenderUUID(ctx));
return 1;
}
else {
Expand All @@ -300,7 +300,7 @@ public static int resume(CommandContext<ServerCommandSource> ctx){
Photographer p = requirePlayer(ctx);
if (p != null){
p.setPaused(false);
ctx.getSource().getMinecraftServer().getPlayerManager().broadcastChatMessage(render(SReplayMod.getFormats().recordingResumed, ctx.getSource().getName(), p.getGameProfile().getName()), MessageType.GAME_INFO, getSenderUUID(ctx));
ctx.getSource().getMinecraftServer().getPlayerManager().broadcastChatMessage(render(SReplayMod.getFormats().recordingResumed, ctx.getSource().getName(), p.getGameProfile().getName()), MessageType.CHAT, getSenderUUID(ctx));
return 1;
}
else {
Expand Down Expand Up @@ -358,15 +358,15 @@ public static int deleteRecording(CommandContext<ServerCommandSource> ctx) {
try {
Files.delete(rec.toPath());
server.getPlayerManager()
.broadcastChatMessage(render(SReplayMod.getFormats().deletedRecordingFile, src.getName(), rec.getName()), MessageType.GAME_INFO, getSenderUUID(ctx));
.broadcastChatMessage(render(SReplayMod.getFormats().deletedRecordingFile, src.getName(), rec.getName()), MessageType.CHAT, getSenderUUID(ctx));
} catch (IOException e) {
e.printStackTrace();
server.getPlayerManager().broadcastChatMessage(render(
SReplayMod.getFormats().failedToDeleteRecordingFile,
src.getName(),
rec.getName(),
e
), MessageType.GAME_INFO, getSenderUUID(ctx));
), MessageType.CHAT, getSenderUUID(ctx));
}
});
} else {
Expand All @@ -389,7 +389,7 @@ public static int playerTp(CommandContext<ServerCommandSource> ctx) {
if (p != null){
Vec3d pos = ctx.getSource().getPosition();
p.tp(ctx.getSource().getWorld().getRegistryKey(), pos.x, pos.y, pos.z);
ctx.getSource().getMinecraftServer().getPlayerManager().broadcastChatMessage(render(SReplayMod.getFormats().teleportedBotToYou, p.getGameProfile().getName(), ctx.getSource().getName()), MessageType.GAME_INFO, getSenderUUID(ctx));
ctx.getSource().getMinecraftServer().getPlayerManager().broadcastChatMessage(render(SReplayMod.getFormats().teleportedBotToYou, p.getGameProfile().getName(), ctx.getSource().getName()), MessageType.CHAT, getSenderUUID(ctx));
LOGGER.info("Teleported {} to {}", p.getGameProfile().getName(), ctx.getSource().getName());
return 1;
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/hadroncfy/sreplay/recording/Photographer.java
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,11 @@ private void updatePause() {
final String name = getGameProfile().getName();
if (trackedPlayers.isEmpty() && !recorder.isRecordingPaused()) {
recorder.pauseRecording();
server.getPlayerManager().broadcastChatMessage(render(SReplayMod.getFormats().autoPaused, name), MessageType.GAME_INFO, NIL);
server.getPlayerManager().broadcastChatMessage(render(SReplayMod.getFormats().autoPaused, name), MessageType.CHAT, NIL);
}
if (!trackedPlayers.isEmpty() && recorder.isRecordingPaused()) {
recorder.resumeRecording();
server.getPlayerManager().broadcastChatMessage(render(SReplayMod.getFormats().autoResumed, name), MessageType.GAME_INFO, NIL);
server.getPlayerManager().broadcastChatMessage(render(SReplayMod.getFormats().autoResumed, name), MessageType.CHAT, NIL);
}
} else {
recorder.resumeRecording();
Expand Down Expand Up @@ -349,13 +349,13 @@ public CompletableFuture<Void> kill(boolean async) {
.saveRecording(saveFile, new RecordingSaveProgressBar(server, saveFile.getName())).thenRun(() -> {
server.getPlayerManager()
.broadcastChatMessage(TextRenderer.render(SReplayMod.getFormats().savedRecordingFile,
getGameProfile().getName(), saveFile.getName()), MessageType.GAME_INFO, NIL);
getGameProfile().getName(), saveFile.getName()), MessageType.CHAT, NIL);
}).exceptionally(exception -> {
exception.printStackTrace();
server.getPlayerManager().broadcastChatMessage(
TextRenderer.render(SReplayMod.getFormats().failedToSaveRecordingFile,
getGameProfile().getName(), exception.toString()),
MessageType.GAME_INFO, NIL);
MessageType.CHAT, NIL);
return null;
});
if (!async) {
Expand Down Expand Up @@ -384,7 +384,7 @@ public void reconnect() {
} catch (IOException e) {
server.getPlayerManager().broadcastChatMessage(
TextRenderer.render(SReplayMod.getFormats().failedToStartRecording, getGameProfile().getName()),
MessageType.GAME_INFO, NIL);
MessageType.CHAT, NIL);
e.printStackTrace();
}
});
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/hadroncfy/sreplay/recording/Recorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void start() {
metaData.date = startTime;
metaData.mcversion = SharedConstants.getGameVersion().getName();
server.getPlayerManager()
.broadcastChatMessage(TextRenderer.render(SReplayMod.getFormats().startedRecording, profile.getName()), MessageType.GAME_INFO, new UUID(0, 0));
.broadcastChatMessage(TextRenderer.render(SReplayMod.getFormats().startedRecording, profile.getName()), MessageType.CHAT, new UUID(0, 0));

// Must contain this packet, otherwise ReplayMod would complain
savePacket(new LoginSuccessS2CPacket(profile));
Expand Down Expand Up @@ -253,7 +253,7 @@ public CompletableFuture<Void> saveRecording(File dest, ProgressBar bar) {
if (!isSaving){
isSaving = true;
metaData.duration = (int) lastPacket;
server.getPlayerManager().broadcastChatMessage(TextRenderer.render(SReplayMod.getFormats().savingRecordingFile, profile.getName()), MessageType.GAME_INFO, new UUID(0, 0));
server.getPlayerManager().broadcastChatMessage(TextRenderer.render(SReplayMod.getFormats().savingRecordingFile, profile.getName()), MessageType.CHAT, new UUID(0, 0));
return CompletableFuture.runAsync(() -> {
saveMetadata();
saveMarkers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public int run(CommandContext<ServerCommandSource> context) throws CommandSyntax
player.getGameProfile().getName(),
entry.name,
entry.field.get(player.getRecordingParam()).toString()
), MessageType.GAME_INFO, SReplayCommand.getSenderUUID(context));
), MessageType.CHAT, SReplayCommand.getSenderUUID(context));
}
}
catch(InvalidEnumException e){
Expand Down

0 comments on commit 0a48848

Please sign in to comment.