diff --git a/README.md b/README.md index 976a425..3e30370 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ PlayTimeLimiter ### What is it? -PlayTimeLimiter is a CanaryMod plugin for Minecraft servers to only allow players to limit the amount of time players spent on your server. +PlayTimeLimiter is a CanaryLib plugin for Minecraft servers to only allow players to limit the amount of time players spend on your server. ### Links diff --git a/pom.xml b/pom.xml index aa05076..7059733 100644 --- a/pom.xml +++ b/pom.xml @@ -8,8 +8,8 @@ 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.25 + PlayTimeLimiter is a CanaryLib plugin for Minecraft servers to only allow players to limit the amount of time players spend on your server. + 0.3 2014 diff --git a/src/main/java/unomodding/canary/playtimelimiter/PlayTimeCommands.java b/src/main/java/unomodding/canary/playtimelimiter/PlayTimeCommands.java index 57dbdf7..6c3c6ae 100644 --- a/src/main/java/unomodding/canary/playtimelimiter/PlayTimeCommands.java +++ b/src/main/java/unomodding/canary/playtimelimiter/PlayTimeCommands.java @@ -1,5 +1,5 @@ /** - * Copyright 2014 by RyanTheAlmighty, UnoModding and Contributors + * Copyright 2014 by UnoModding, RyanTheAlmighty and Contributors * * This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. * To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/. @@ -10,6 +10,7 @@ import net.canarymod.Canary; import net.canarymod.api.entity.living.humanoid.Player; +import net.canarymod.chat.Colors; import net.canarymod.chat.MessageReceiver; import net.canarymod.chat.TextFormat; import net.canarymod.commandsys.Command; @@ -42,9 +43,9 @@ public void baseCommand(MessageReceiver caller, String[] args) { version = 2) public void startCommand(MessageReceiver caller, String[] args) { if (!plugin.start()) { - caller.message(TextFormat.RED + "Playtime already started!"); + caller.message(Colors.RED + "Playtime already started!"); } else { - caller.message(TextFormat.RED + "Playtime started!"); + caller.message(Colors.RED + "Playtime started!"); } } @@ -56,9 +57,9 @@ public void startCommand(MessageReceiver caller, String[] args) { version = 2) public void stopCommand(MessageReceiver caller, String[] args) { if (!plugin.stop()) { - caller.message(TextFormat.RED + "Playtime already stopped!"); + caller.message(Colors.RED + "Playtime already stopped!"); } else { - caller.message(TextFormat.RED + "Playtime stopped!"); + caller.message(Colors.RED + "Playtime stopped!"); } } @@ -70,14 +71,14 @@ public void stopCommand(MessageReceiver caller, String[] args) { version = 2) public void checkCommand(MessageReceiver caller, String[] args) { if (!plugin.hasStarted()) { - caller.message(TextFormat.RED + "Playtime hasn't started yet!"); + caller.message(Colors.RED + "Playtime hasn't started yet!"); } else { if (args.length == 0) { if (!caller.hasPermission("playtimelimiter.playtime.check.self")) { - caller.message(TextFormat.RED + "You don't have permission to check your playtime!"); + caller.message(Colors.RED + "You don't have permission to check your playtime!"); } else { Player player = Canary.getServer().getPlayer(caller.getName()); - caller.message(TextFormat.GREEN + caller.message(Colors.GREEN + "You have played for " + plugin.secondsToDaysHoursSecondsString(plugin.getPlayerPlayTime(player .getUUIDString())) @@ -87,11 +88,10 @@ public void checkCommand(MessageReceiver caller, String[] args) { } } else if (args.length == 1) { if (!caller.hasPermission("playtimelimiter.playtime.check.others")) { - caller.message(TextFormat.RED - + "You don't have permission to check other players playtime!"); + caller.message(Colors.RED + "You don't have permission to check other players playtime!"); } else { Player player = Canary.getServer().getPlayer(args[0]); - caller.message(TextFormat.GREEN + caller.message(Colors.GREEN + player.getName() + " has played for " + plugin.secondsToDaysHoursSecondsString(plugin.getPlayerPlayTime(player @@ -112,19 +112,19 @@ public void checkCommand(MessageReceiver caller, String[] args) { version = 2) public void addCommand(MessageReceiver caller, String[] args) { if (!plugin.hasStarted()) { - caller.message(TextFormat.RED + "Playtime hasn't started yet!"); + caller.message(Colors.RED + "Playtime hasn't started yet!"); } else { try { plugin.addPlayTime(Canary.getServer().getPlayer(args[0]).getUUIDString(), Integer.parseInt(args[1])); - caller.message(TextFormat.GREEN + "Added " + Integer.parseInt(args[1]) + caller.message(Colors.GREEN + "Added " + Integer.parseInt(args[1]) + " seconds of playtime from " + args[0]); } catch (NumberFormatException e) { e.printStackTrace(); - caller.message(TextFormat.RED + "Invalid number of seconds given!"); + caller.message(Colors.RED + "Invalid number of seconds given!"); } catch (UnknownPlayerException e) { e.printStackTrace(); - caller.message(TextFormat.RED + e.getMessage()); + caller.message(Colors.RED + e.getMessage()); } } } @@ -137,16 +137,16 @@ public void addCommand(MessageReceiver caller, String[] args) { version = 2) public void removeCommand(MessageReceiver caller, String[] args) { if (!plugin.hasStarted()) { - caller.message(TextFormat.RED + "Playtime hasn't started yet!"); + caller.message(Colors.RED + "Playtime hasn't started yet!"); } else { try { plugin.removePlayTime(Canary.getServer().getPlayer(args[0]).getUUIDString(), Integer.parseInt(args[1])); - caller.message(TextFormat.GREEN + "Removed " + Integer.parseInt(args[1]) + caller.message(Colors.GREEN + "Removed " + Integer.parseInt(args[1]) + " seconds of playtime from " + args[0]); } catch (NumberFormatException e) { e.printStackTrace(); - caller.message(TextFormat.RED + "Invalid number of seconds given!"); + caller.message(Colors.RED + "Invalid number of seconds given!"); } } } @@ -166,28 +166,28 @@ public List playtimeTabComplete(MessageReceiver caller, String[] paramet } public void printUsage(MessageReceiver caller) { - caller.message(TextFormat.YELLOW + "/playtime usage:"); + caller.message(Colors.YELLOW + "/playtime usage:"); if (caller.hasPermission("playtimelimiter.playtime.start")) { - caller.message(TextFormat.CYAN + "/playtime start" + TextFormat.RESET + caller.message(Colors.CYAN + "/playtime start" + TextFormat.RESET + " - Start the playtime counter."); } if (caller.hasPermission("playtimelimiter.playtime.stop")) { - caller.message(TextFormat.CYAN + "/playtime stop" + TextFormat.RESET + caller.message(Colors.CYAN + "/playtime stop" + TextFormat.RESET + " - Stop the playtime counter."); } if (caller.hasPermission("playtimelimiter.playtime.add")) { - caller.message(TextFormat.CYAN + "/playtime add