From 4f7678fed61ac50ba806b20d276e54747e251e31 Mon Sep 17 00:00:00 2001 From: graywolf336 Date: Sat, 26 Apr 2014 22:29:36 -0500 Subject: [PATCH 1/4] Fix the name portion of the prisoners not loading. --- src/main/java/com/graywolf336/jail/JailIO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/graywolf336/jail/JailIO.java b/src/main/java/com/graywolf336/jail/JailIO.java index 9279e9c..81fcb73 100644 --- a/src/main/java/com/graywolf336/jail/JailIO.java +++ b/src/main/java/com/graywolf336/jail/JailIO.java @@ -621,7 +621,7 @@ public class JailIO { for(String uuid : prisoners) { String pNode = node + "prisoners." + uuid + "."; Prisoner pris = new Prisoner(uuid, - flat.getString(pNode + "prisoner"), + flat.getString(pNode + "name"), flat.getBoolean(pNode + "muted"), flat.getLong(pNode + "time"), flat.getString(pNode + "jailer"), From 6c5557806246853444335de82a20fbd3e7ee4e2f Mon Sep 17 00:00:00 2001 From: graywolf336 Date: Sun, 27 Apr 2014 00:05:35 -0500 Subject: [PATCH 2/4] Try to provide backwards compatibility. --- .../com/graywolf336/jail/command/CommandHandler.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/com/graywolf336/jail/command/CommandHandler.java b/src/main/java/com/graywolf336/jail/command/CommandHandler.java index 1d654fd..dca3622 100644 --- a/src/main/java/com/graywolf336/jail/command/CommandHandler.java +++ b/src/main/java/com/graywolf336/jail/command/CommandHandler.java @@ -61,6 +61,18 @@ public class CommandHandler { //If no matches were found, send them the unknown command message. if(matches.size() == 0) { + if(commandLine.startsWith("jail")) { + String j = commandLine.substring(0, 4); + String a0 = commandLine.substring(4, commandLine.length()); + + ArrayList args2 = new ArrayList(); + for(String s : args) + args2.add(s); + args2.add(a0); + + jailmanager.getPlugin().onCommand(sender, null, j, args2.toArray(new String[args2.size()])); + } + sender.sendMessage(jailmanager.getPlugin().getJailIO().getLanguageString(LangString.UNKNOWNCOMMAND, commandLine)); return; } From 7167bff98102e282d078e832df75f0f3d077942c Mon Sep 17 00:00:00 2001 From: graywolf336 Date: Sun, 27 Apr 2014 00:19:23 -0500 Subject: [PATCH 3/4] Fix the NPE when providing backward compabitility. --- src/main/java/com/graywolf336/jail/JailMain.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/graywolf336/jail/JailMain.java b/src/main/java/com/graywolf336/jail/JailMain.java index b73e722..0a02fae 100644 --- a/src/main/java/com/graywolf336/jail/JailMain.java +++ b/src/main/java/com/graywolf336/jail/JailMain.java @@ -149,7 +149,7 @@ public class JailMain extends JavaPlugin { * Send the command off to the CommandHandler class, that way this main class doesn't get clogged up. */ public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) { - if(command.getName().equalsIgnoreCase("jail")) { + if(commandLabel.equalsIgnoreCase("jail") || commandLabel.equalsIgnoreCase("j")) { jh.parseCommand(jm, sender, args); }else { cmdHand.handleCommand(jm, sender, command.getName().toLowerCase(), args); From 5241f917ce5acb49c52bf1750ebdcf67d342f32a Mon Sep 17 00:00:00 2001 From: graywolf336 Date: Sun, 27 Apr 2014 00:29:08 -0500 Subject: [PATCH 4/4] Don't double send the message on backwards support for commands. --- src/main/java/com/graywolf336/jail/command/CommandHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/graywolf336/jail/command/CommandHandler.java b/src/main/java/com/graywolf336/jail/command/CommandHandler.java index dca3622..7180192 100644 --- a/src/main/java/com/graywolf336/jail/command/CommandHandler.java +++ b/src/main/java/com/graywolf336/jail/command/CommandHandler.java @@ -70,7 +70,8 @@ public class CommandHandler { args2.add(s); args2.add(a0); - jailmanager.getPlugin().onCommand(sender, null, j, args2.toArray(new String[args2.size()])); + if(jailmanager.getPlugin().onCommand(sender, null, j, args2.toArray(new String[args2.size()]))) + return; } sender.sendMessage(jailmanager.getPlugin().getJailIO().getLanguageString(LangString.UNKNOWNCOMMAND, commandLine));