From edb563a9ecd2834df940c4ba11a4655dff53cfeb Mon Sep 17 00:00:00 2001 From: graywolf336 Date: Wed, 29 Jan 2014 13:46:26 -0600 Subject: [PATCH] Move mute, reload, and version to the subcommand of /jail --- .../jail/command/CommandHandler.java | 6 ------ .../graywolf336/jail/command/JailHandler.java | 17 ++++++++++++++--- .../jcommands/{ListJails.java => JailList.java} | 2 +- .../jail/command/jcommands/Mute.java | 13 +++++++++++++ .../jail/command/jcommands/Reload.java | 13 +++++++++++++ .../jail/command/jcommands/Version.java | 13 +++++++++++++ .../JailMuteCommand.java | 6 +++--- .../JailReloadCommand.java | 6 +++--- .../JailVersionCommand.java | 6 +++--- 9 files changed, 63 insertions(+), 19 deletions(-) rename src/main/java/com/graywolf336/jail/command/jcommands/{ListJails.java => JailList.java} (89%) create mode 100644 src/main/java/com/graywolf336/jail/command/jcommands/Mute.java create mode 100644 src/main/java/com/graywolf336/jail/command/jcommands/Reload.java create mode 100644 src/main/java/com/graywolf336/jail/command/jcommands/Version.java rename src/main/java/com/graywolf336/jail/command/{commands => subcommands}/JailMuteCommand.java (89%) rename src/main/java/com/graywolf336/jail/command/{commands => subcommands}/JailReloadCommand.java (84%) rename src/main/java/com/graywolf336/jail/command/{commands => subcommands}/JailVersionCommand.java (85%) diff --git a/src/main/java/com/graywolf336/jail/command/CommandHandler.java b/src/main/java/com/graywolf336/jail/command/CommandHandler.java index 8af4a6c..b02da7f 100644 --- a/src/main/java/com/graywolf336/jail/command/CommandHandler.java +++ b/src/main/java/com/graywolf336/jail/command/CommandHandler.java @@ -17,13 +17,10 @@ import com.graywolf336.jail.command.commands.JailClearCommand; import com.graywolf336.jail.command.commands.JailClearForceCommand; import com.graywolf336.jail.command.commands.JailCreateCommand; import com.graywolf336.jail.command.commands.JailListCellsCommand; -import com.graywolf336.jail.command.commands.JailMuteCommand; -import com.graywolf336.jail.command.commands.JailReloadCommand; import com.graywolf336.jail.command.commands.JailRemoveCellCommand; import com.graywolf336.jail.command.commands.JailStopCommand; import com.graywolf336.jail.command.commands.JailTeleInCommand; import com.graywolf336.jail.command.commands.JailTeleOutCommand; -import com.graywolf336.jail.command.commands.JailVersionCommand; import com.graywolf336.jail.command.commands.UnHandCuffCommand; import com.graywolf336.jail.command.commands.UnjailCommand; import com.graywolf336.jail.enums.LangString; @@ -156,13 +153,10 @@ public class CommandHandler { load(JailClearForceCommand.class); load(JailCreateCommand.class); load(JailListCellsCommand.class); - load(JailMuteCommand.class); - load(JailReloadCommand.class); load(JailRemoveCellCommand.class); load(JailStopCommand.class); load(JailTeleInCommand.class); load(JailTeleOutCommand.class); - load(JailVersionCommand.class); load(UnHandCuffCommand.class); load(UnjailCommand.class); } diff --git a/src/main/java/com/graywolf336/jail/command/JailHandler.java b/src/main/java/com/graywolf336/jail/command/JailHandler.java index 6553511..49523d8 100644 --- a/src/main/java/com/graywolf336/jail/command/JailHandler.java +++ b/src/main/java/com/graywolf336/jail/command/JailHandler.java @@ -10,13 +10,18 @@ import org.bukkit.entity.Player; import com.beust.jcommander.JCommander; import com.beust.jcommander.ParameterException; - import com.graywolf336.jail.JailMain; import com.graywolf336.jail.JailManager; import com.graywolf336.jail.command.jcommands.JailFoundation; -import com.graywolf336.jail.command.jcommands.ListJails; +import com.graywolf336.jail.command.jcommands.JailList; +import com.graywolf336.jail.command.jcommands.Mute; +import com.graywolf336.jail.command.jcommands.Reload; +import com.graywolf336.jail.command.jcommands.Version; import com.graywolf336.jail.command.subcommands.JailCommand; import com.graywolf336.jail.command.subcommands.JailListCommand; +import com.graywolf336.jail.command.subcommands.JailMuteCommand; +import com.graywolf336.jail.command.subcommands.JailReloadCommand; +import com.graywolf336.jail.command.subcommands.JailVersionCommand; import com.graywolf336.jail.enums.LangString; public class JailHandler { @@ -37,7 +42,10 @@ public class JailHandler { JCommander jc = new JCommander(foundation); //Now let's add the subcommands - jc.addCommand("list", new ListJails()); + jc.addCommand("list", new JailList()); + jc.addCommand("mute", new Mute()); + jc.addCommand("reload", new Reload()); + jc.addCommand("version", new Version()); try { jc.parse(args); @@ -152,6 +160,9 @@ public class JailHandler { private void loadCommands() { load(JailCommand.class); load(JailListCommand.class); + load(JailMuteCommand.class); + load(JailReloadCommand.class); + load(JailVersionCommand.class); } private void load(Class c) { diff --git a/src/main/java/com/graywolf336/jail/command/jcommands/ListJails.java b/src/main/java/com/graywolf336/jail/command/jcommands/JailList.java similarity index 89% rename from src/main/java/com/graywolf336/jail/command/jcommands/ListJails.java rename to src/main/java/com/graywolf336/jail/command/jcommands/JailList.java index c3b4497..0c57a05 100644 --- a/src/main/java/com/graywolf336/jail/command/jcommands/ListJails.java +++ b/src/main/java/com/graywolf336/jail/command/jcommands/JailList.java @@ -7,7 +7,7 @@ import com.beust.jcommander.Parameter; import com.beust.jcommander.Parameters; @Parameters(commandDescription = "Lists all the jails in the system.") -public class ListJails { +public class JailList { @Parameter private List parameters = new ArrayList(); } diff --git a/src/main/java/com/graywolf336/jail/command/jcommands/Mute.java b/src/main/java/com/graywolf336/jail/command/jcommands/Mute.java new file mode 100644 index 0000000..a8b1146 --- /dev/null +++ b/src/main/java/com/graywolf336/jail/command/jcommands/Mute.java @@ -0,0 +1,13 @@ +package com.graywolf336.jail.command.jcommands; + +import java.util.ArrayList; +import java.util.List; + +import com.beust.jcommander.Parameter; +import com.beust.jcommander.Parameters; + +@Parameters(commandDescription = "Mutes a player who is in jail.") +public class Mute { + @Parameter + private List parameters = new ArrayList(); +} diff --git a/src/main/java/com/graywolf336/jail/command/jcommands/Reload.java b/src/main/java/com/graywolf336/jail/command/jcommands/Reload.java new file mode 100644 index 0000000..c6d2d96 --- /dev/null +++ b/src/main/java/com/graywolf336/jail/command/jcommands/Reload.java @@ -0,0 +1,13 @@ +package com.graywolf336.jail.command.jcommands; + +import java.util.ArrayList; +import java.util.List; + +import com.beust.jcommander.Parameter; +import com.beust.jcommander.Parameters; + +@Parameters(commandDescription = "Reloads the plugin and data and all.") +public class Reload { + @Parameter + private List parameters = new ArrayList(); +} diff --git a/src/main/java/com/graywolf336/jail/command/jcommands/Version.java b/src/main/java/com/graywolf336/jail/command/jcommands/Version.java new file mode 100644 index 0000000..7f92904 --- /dev/null +++ b/src/main/java/com/graywolf336/jail/command/jcommands/Version.java @@ -0,0 +1,13 @@ +package com.graywolf336.jail.command.jcommands; + +import java.util.ArrayList; +import java.util.List; + +import com.beust.jcommander.Parameter; +import com.beust.jcommander.Parameters; + +@Parameters(commandDescription = "Shows the version of the plugin.") +public class Version { + @Parameter + private List parameters = new ArrayList(); +} diff --git a/src/main/java/com/graywolf336/jail/command/commands/JailMuteCommand.java b/src/main/java/com/graywolf336/jail/command/subcommands/JailMuteCommand.java similarity index 89% rename from src/main/java/com/graywolf336/jail/command/commands/JailMuteCommand.java rename to src/main/java/com/graywolf336/jail/command/subcommands/JailMuteCommand.java index 3c52366..f7fe032 100644 --- a/src/main/java/com/graywolf336/jail/command/commands/JailMuteCommand.java +++ b/src/main/java/com/graywolf336/jail/command/subcommands/JailMuteCommand.java @@ -1,4 +1,4 @@ -package com.graywolf336.jail.command.commands; +package com.graywolf336.jail.command.subcommands; import org.bukkit.command.CommandSender; @@ -11,9 +11,9 @@ import com.graywolf336.jail.enums.LangString; maxArgs = 1, minimumArgs = 1, needsPlayer = false, - pattern = "jailmute|jmute", + pattern = "mute|m", permission = "jail.command.jailmute", - usage = "/jailmute " + usage = "/jail mute " ) public class JailMuteCommand implements Command { public boolean execute(JailManager jm, CommandSender sender, String... args) throws Exception { diff --git a/src/main/java/com/graywolf336/jail/command/commands/JailReloadCommand.java b/src/main/java/com/graywolf336/jail/command/subcommands/JailReloadCommand.java similarity index 84% rename from src/main/java/com/graywolf336/jail/command/commands/JailReloadCommand.java rename to src/main/java/com/graywolf336/jail/command/subcommands/JailReloadCommand.java index 30fccd5..bb0d184 100644 --- a/src/main/java/com/graywolf336/jail/command/commands/JailReloadCommand.java +++ b/src/main/java/com/graywolf336/jail/command/subcommands/JailReloadCommand.java @@ -1,4 +1,4 @@ -package com.graywolf336.jail.command.commands; +package com.graywolf336.jail.command.subcommands; import org.bukkit.command.CommandSender; @@ -11,9 +11,9 @@ import com.graywolf336.jail.enums.LangString; maxArgs = 0, minimumArgs = 0, needsPlayer = false, - pattern = "jailreload", + pattern = "reload|r", permission = "jail.command.jailreload", - usage = "/jailreload" + usage = "/jail reload" ) public class JailReloadCommand implements Command { public boolean execute(JailManager jm, CommandSender sender, String... args) { diff --git a/src/main/java/com/graywolf336/jail/command/commands/JailVersionCommand.java b/src/main/java/com/graywolf336/jail/command/subcommands/JailVersionCommand.java similarity index 85% rename from src/main/java/com/graywolf336/jail/command/commands/JailVersionCommand.java rename to src/main/java/com/graywolf336/jail/command/subcommands/JailVersionCommand.java index 38e1405..7798a32 100644 --- a/src/main/java/com/graywolf336/jail/command/commands/JailVersionCommand.java +++ b/src/main/java/com/graywolf336/jail/command/subcommands/JailVersionCommand.java @@ -1,4 +1,4 @@ -package com.graywolf336.jail.command.commands; +package com.graywolf336.jail.command.subcommands; import org.bukkit.command.CommandSender; @@ -10,9 +10,9 @@ import com.graywolf336.jail.command.CommandInfo; maxArgs = 0, minimumArgs = 0, needsPlayer = false, - pattern = "jailversion|jv", + pattern = "version|v", permission = "jail.command.jailversion", - usage = "/jailversion" + usage = "/jail version" ) public class JailVersionCommand implements Command{