13
0

Add JumpAndRunCommand.toggleReplay
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2023-04-08 15:42:35 +02:00
Ursprung c59082320b
Commit 4243669e0b
4 geänderte Dateien mit 22 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -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

Datei anzeigen

@ -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

Datei anzeigen

@ -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());

Datei anzeigen

@ -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);
}
}
}