diff --git a/pom.xml b/pom.xml index 893a417..8c8e918 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ PlayTimeLimiter https://github.com/UnoModding/Canary-PlayTimeLimiter PlayTimeLimiter is a CanaryMod plugin for Minecraft servers to only allow players to limit the amount of time players spent on your server. - 0.2-dev + 0.2 2014 diff --git a/src/main/java/unomodding/canary/playtimelimiter/PlayTimeCommands.java b/src/main/java/unomodding/canary/playtimelimiter/PlayTimeCommands.java index a4e39a1..17d2e81 100644 --- a/src/main/java/unomodding/canary/playtimelimiter/PlayTimeCommands.java +++ b/src/main/java/unomodding/canary/playtimelimiter/PlayTimeCommands.java @@ -108,15 +108,15 @@ public void checkCommand(MessageReceiver caller, String[] args) { parent = "playtime", description = "add subcommand", permissions = { "playtimelimiter.playtime.add" }, - toolTip = "/playtime add [seconds]", + toolTip = "/playtime add ", version = 2) public void addCommand(MessageReceiver caller, String[] args) { if (!plugin.hasStarted()) { caller.message(TextFormat.RED + "Playtime hasn't started yet!"); } else { try { - plugin.removePlayTime(Canary.getServer().getPlayer(args[0]).getUUIDString(), - Integer.parseInt(args[0])); + plugin.addPlayTime(Canary.getServer().getPlayer(args[0]).getUUIDString(), + Integer.parseInt(args[1])); caller.message(TextFormat.GREEN + "Added " + Integer.parseInt(args[1]) + " seconds of playtime from " + args[0]); } catch (NumberFormatException e) { @@ -133,7 +133,7 @@ public void addCommand(MessageReceiver caller, String[] args) { parent = "playtime", description = "remove subcommand", permissions = { "playtimelimiter.playtime.remove" }, - toolTip = "/playtime remove [seconds]", + toolTip = "/playtime remove ", version = 2) public void removeCommand(MessageReceiver caller, String[] args) { if (!plugin.hasStarted()) { @@ -147,9 +147,6 @@ public void removeCommand(MessageReceiver caller, String[] args) { } catch (NumberFormatException e) { e.printStackTrace(); caller.message(TextFormat.RED + "Invalid number of seconds given!"); - } catch (UnknownPlayerException e) { - e.printStackTrace(); - caller.message(TextFormat.RED + e.getMessage()); } } } diff --git a/src/main/java/unomodding/canary/playtimelimiter/PlayTimeLimiter.java b/src/main/java/unomodding/canary/playtimelimiter/PlayTimeLimiter.java index 8e95032..625828d 100644 --- a/src/main/java/unomodding/canary/playtimelimiter/PlayTimeLimiter.java +++ b/src/main/java/unomodding/canary/playtimelimiter/PlayTimeLimiter.java @@ -148,19 +148,19 @@ public int getTimeAllowedInSeconds(String uuid) { return secondsAllowed; } - public void addPlayTime(String uuid, int seconds) { + public void addPlayTime(String uuid, int seconds) throws UnknownPlayerException { if (this.timePlayed.containsKey(uuid)) { - this.timePlayed.put(uuid, this.timePlayed.get(uuid) + seconds); + this.timePlayed.put(uuid, this.timePlayed.get(uuid) - seconds); } else { - this.timePlayed.put(uuid, seconds); + throw new UnknownPlayerException(uuid); } } - public void removePlayTime(String uuid, int seconds) throws UnknownPlayerException { + public void removePlayTime(String uuid, int seconds) { if (this.timePlayed.containsKey(uuid)) { - this.timePlayed.put(uuid, this.timePlayed.get(uuid) - seconds); + this.timePlayed.put(uuid, this.timePlayed.get(uuid) + seconds); } else { - throw new UnknownPlayerException(uuid); + this.timePlayed.put(uuid, seconds); } }