diff --git a/src/de/steamwar/lobby/LobbySystem.java b/src/de/steamwar/lobby/LobbySystem.java index f87d9d4..3fce387 100644 --- a/src/de/steamwar/lobby/LobbySystem.java +++ b/src/de/steamwar/lobby/LobbySystem.java @@ -25,6 +25,7 @@ import de.steamwar.lobby.command.HologramCommand; import de.steamwar.lobby.command.ModifyCommand; import de.steamwar.lobby.command.PortalCommand; import de.steamwar.lobby.jumpandrun.JumpAndRun; +import de.steamwar.lobby.jumpandrun.JumpAndRunCommand; import de.steamwar.lobby.listener.*; import de.steamwar.lobby.map.CustomMapCommand; import de.steamwar.lobby.particle.ParticleListener; @@ -61,6 +62,7 @@ public class LobbySystem extends JavaPlugin { new CustomMapCommand(); new JumpAndRun(); + new JumpAndRunCommand(); config = new Config(getConfig()); new PlayerSpawn(); diff --git a/src/de/steamwar/lobby/LobbySystem.properties b/src/de/steamwar/lobby/LobbySystem.properties index 5b3dbca..86ee7ef 100644 --- a/src/de/steamwar/lobby/LobbySystem.properties +++ b/src/de/steamwar/lobby/LobbySystem.properties @@ -131,6 +131,8 @@ JUMP_AND_RUN_CANCEL = {0} JUMP_AND_RUN_TIME = mm:ss SSS 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 # Easter Egg Hunt DIFFICULTY_EASY = §aEasy diff --git a/src/de/steamwar/lobby/LobbySystem_de.properties b/src/de/steamwar/lobby/LobbySystem_de.properties index 5bd4406..b451a73 100644 --- a/src/de/steamwar/lobby/LobbySystem_de.properties +++ b/src/de/steamwar/lobby/LobbySystem_de.properties @@ -120,7 +120,9 @@ PARTICLE_EGG_HUNT_ADVANCED = §5Abheben PARTICLE_EGG_HUNT_HALF = §fDie Jagd ist eröffnet JUMP_AND_RUN_FINISHED = §aBeendet in {0} mit {1} Fails -JUMP_AND_RUN_PERSONAL_BEST = §aNice! Du hast deinen Rekord um {0} Sekunden verbessert! +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 # Easter Egg Hunt DIFFICULTY_EASY = §aLeicht diff --git a/src/de/steamwar/lobby/jumpandrun/JumpAndRunCommand.java b/src/de/steamwar/lobby/jumpandrun/JumpAndRunCommand.java new file mode 100644 index 0000000..680f01b --- /dev/null +++ b/src/de/steamwar/lobby/jumpandrun/JumpAndRunCommand.java @@ -0,0 +1,30 @@ +package de.steamwar.lobby.jumpandrun; + +import de.steamwar.command.SWCommand; +import de.steamwar.lobby.LobbySystem; +import de.steamwar.sql.UserConfig; +import org.bukkit.entity.Player; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; + +public class JumpAndRunCommand extends SWCommand { + + public JumpAndRunCommand() { + super("jumpandrun"); + } + + @Register + public void genericCommand(Player player, String... args) { + String time = UserConfig.getConfig(player.getUniqueId(), "jump_and_run"); + if (time == null) { + LobbySystem.getMessage().sendPrefixless("JUMP_AND_RUN_PERSONAL_BEST_NO_TIME", player); + return; + } + long timeLong = Long.parseLong(time); + SimpleDateFormat format = new SimpleDateFormat(LobbySystem.getMessage().parse("JUMP_AND_RUN_TIME", player), Locale.ROOT); + String parsed = format.format(new Date(timeLong)); + LobbySystem.getMessage().sendPrefixless("JUMP_AND_RUN_PERSONAL_BEST_TIME", player, parsed); + } +}