diff --git a/src/de/steamwar/lobby/LobbySystem.properties b/src/de/steamwar/lobby/LobbySystem.properties index fdb5cb1..c250d9c 100644 --- a/src/de/steamwar/lobby/LobbySystem.properties +++ b/src/de/steamwar/lobby/LobbySystem.properties @@ -134,6 +134,8 @@ JUMP_AND_RUN_FINISHED = §aFinished in {0} with {1} fails JUMP_AND_RUN_PERSONAL_BEST = §aNice! You beat your personal best by {0} JUMP_AND_RUN_PERSONAL_BEST_TIME = §aPersonal best in {0} JUMP_AND_RUN_PERSONAL_BEST_NO_TIME = §cNo personal best +JUMP_AND_RUN_REPLAY_ENABLED = §aReplay enabled +JUMP_AND_RUN_REPLAY_DISABLED = §cReplay disabled # Games GAMES_TICTACTOE = TicTacToe diff --git a/src/de/steamwar/lobby/LobbySystem_de.properties b/src/de/steamwar/lobby/LobbySystem_de.properties index c5172f9..4824c0e 100644 --- a/src/de/steamwar/lobby/LobbySystem_de.properties +++ b/src/de/steamwar/lobby/LobbySystem_de.properties @@ -125,6 +125,8 @@ JUMP_AND_RUN_FINISHED = §aBeendet in {0} mit {1} Fails JUMP_AND_RUN_PERSONAL_BEST = §aNice! Du hast deinen Rekord um {0} verbessert! JUMP_AND_RUN_PERSONAL_BEST_TIME = §aDein Rekord ist {0} JUMP_AND_RUN_PERSONAL_BEST_NO_TIME = §cDu hast noch keinen Rekord +JUMP_AND_RUN_REPLAY_ENABLED = §aReplay aktiviert +JUMP_AND_RUN_REPLAY_DISABLED = §cReplay deaktiviert # Games GAMES_TICTACTOE = TicTacToe diff --git a/src/de/steamwar/lobby/jumpandrun/JumpAndRun.java b/src/de/steamwar/lobby/jumpandrun/JumpAndRun.java index ed16e47..ac7f5c4 100644 --- a/src/de/steamwar/lobby/jumpandrun/JumpAndRun.java +++ b/src/de/steamwar/lobby/jumpandrun/JumpAndRun.java @@ -27,6 +27,7 @@ public class JumpAndRun extends BasicListener { public static final String JUMP_AND_RUN_CONFIG = "jump_and_run"; public static final String JUMP_AND_RUN_REPLAY_CONFIG = "jump_and_run_replay"; + public static final String JUMP_AND_RUN_REPLAY_DISABLED_CONFIG = "jump_and_run_replay_disabled"; private static final String BAR_EMPTY = "||||||||||||||||||||||||||||||"; @@ -127,7 +128,9 @@ public class JumpAndRun extends BasicListener { FAILS.put(event.getPlayer(), 0); START.put(event.getPlayer(), System.currentTimeMillis()); GHOSTS.get(event.getPlayer()).record(); - GHOSTS.get(event.getPlayer()).replay(); + if (UserConfig.getConfig(event.getPlayer().getUniqueId(), JUMP_AND_RUN_REPLAY_DISABLED_CONFIG) == null) { + GHOSTS.get(event.getPlayer()).replay(); + } } if (index == points.size() - 1) { long time = System.currentTimeMillis() - START.get(event.getPlayer()); diff --git a/src/de/steamwar/lobby/jumpandrun/JumpAndRunCommand.java b/src/de/steamwar/lobby/jumpandrun/JumpAndRunCommand.java index 680f01b..b88f2e2 100644 --- a/src/de/steamwar/lobby/jumpandrun/JumpAndRunCommand.java +++ b/src/de/steamwar/lobby/jumpandrun/JumpAndRunCommand.java @@ -9,6 +9,8 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; +import static de.steamwar.lobby.jumpandrun.JumpAndRun.JUMP_AND_RUN_REPLAY_DISABLED_CONFIG; + public class JumpAndRunCommand extends SWCommand { public JumpAndRunCommand() { @@ -27,4 +29,16 @@ public class JumpAndRunCommand extends SWCommand { String parsed = format.format(new Date(timeLong)); LobbySystem.getMessage().sendPrefixless("JUMP_AND_RUN_PERSONAL_BEST_TIME", player, parsed); } + + @Register("togglereplay") + public void toggleReplay(Player player) { + String replay = UserConfig.getConfig(player.getUniqueId(), JUMP_AND_RUN_REPLAY_DISABLED_CONFIG); + if (replay == null) { + UserConfig.updatePlayerConfig(player.getUniqueId(), JUMP_AND_RUN_REPLAY_DISABLED_CONFIG, ""); + LobbySystem.getMessage().sendPrefixless("JUMP_AND_RUN_REPLAY_ENABLED", player); + } else { + UserConfig.updatePlayerConfig(player.getUniqueId(), JUMP_AND_RUN_REPLAY_DISABLED_CONFIG, null); + LobbySystem.getMessage().sendPrefixless("JUMP_AND_RUN_REPLAY_DISABLED", player); + } + } }