diff --git a/src/main/java/com/graywolf336/jail/command/CommandHandler.java b/src/main/java/com/graywolf336/jail/command/CommandHandler.java index b02da7f..b6c6bb4 100644 --- a/src/main/java/com/graywolf336/jail/command/CommandHandler.java +++ b/src/main/java/com/graywolf336/jail/command/CommandHandler.java @@ -18,9 +18,6 @@ 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.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.UnHandCuffCommand; import com.graywolf336.jail.command.commands.UnjailCommand; import com.graywolf336.jail.enums.LangString; @@ -154,9 +151,6 @@ public class CommandHandler { load(JailCreateCommand.class); load(JailListCellsCommand.class); load(JailRemoveCellCommand.class); - load(JailStopCommand.class); - load(JailTeleInCommand.class); - load(JailTeleOutCommand.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 49523d8..23c9927 100644 --- a/src/main/java/com/graywolf336/jail/command/JailHandler.java +++ b/src/main/java/com/graywolf336/jail/command/JailHandler.java @@ -1,6 +1,7 @@ package com.graywolf336.jail.command; import java.util.ArrayList; +import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map.Entry; @@ -16,19 +17,27 @@ import com.graywolf336.jail.command.jcommands.JailFoundation; 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.Stop; +import com.graywolf336.jail.command.jcommands.TeleIn; +import com.graywolf336.jail.command.jcommands.TeleOut; 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.JailStopCommand; +import com.graywolf336.jail.command.subcommands.JailTeleInCommand; +import com.graywolf336.jail.command.subcommands.JailTeleOutCommand; import com.graywolf336.jail.command.subcommands.JailVersionCommand; import com.graywolf336.jail.enums.LangString; public class JailHandler { private LinkedHashMap commands; + private HashMap addCmds; public JailHandler(JailMain plugin) { commands = new LinkedHashMap(); + addCmds = new HashMap(); loadCommands(); plugin.getLogger().info("Loaded " + commands.size() + " sub-commands of /jail."); @@ -41,11 +50,9 @@ public class JailHandler { JailFoundation foundation = new JailFoundation(); JCommander jc = new JCommander(foundation); - //Now let's add the subcommands - jc.addCommand("list", new JailList()); - jc.addCommand("mute", new Mute()); - jc.addCommand("reload", new Reload()); - jc.addCommand("version", new Version()); + for(Entry e : addCmds.entrySet()) { + jc.addCommand(e.getKey(), e.getValue()); + } try { jc.parse(args); @@ -162,7 +169,25 @@ public class JailHandler { load(JailListCommand.class); load(JailMuteCommand.class); load(JailReloadCommand.class); + load(JailStopCommand.class); + load(JailTeleInCommand.class); + load(JailTeleOutCommand.class); load(JailVersionCommand.class); + + //Puts the commands in the HashMap + addCmds.put("list", new JailList()); + addCmds.put("mute", new Mute()); + addCmds.put("m", new Mute()); + addCmds.put("reload", new Reload()); + addCmds.put("r", new Reload()); + addCmds.put("stop", new Stop()); + addCmds.put("s", new Stop()); + addCmds.put("telein", new TeleIn()); + addCmds.put("teleportin", new TeleIn()); + addCmds.put("teleout", new TeleOut()); + addCmds.put("teleportout", new TeleOut()); + addCmds.put("version", new Version()); + addCmds.put("v", new Version()); } private void load(Class c) { diff --git a/src/main/java/com/graywolf336/jail/command/jcommands/Stop.java b/src/main/java/com/graywolf336/jail/command/jcommands/Stop.java new file mode 100644 index 0000000..f361eae --- /dev/null +++ b/src/main/java/com/graywolf336/jail/command/jcommands/Stop.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 = "Stop the creations of anything.") +public class Stop { + @Parameter + private List parameters = new ArrayList(); +} diff --git a/src/main/java/com/graywolf336/jail/command/jcommands/TeleIn.java b/src/main/java/com/graywolf336/jail/command/jcommands/TeleIn.java new file mode 100644 index 0000000..88db871 --- /dev/null +++ b/src/main/java/com/graywolf336/jail/command/jcommands/TeleIn.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 = "Teleports a player to the in of jail.") +public class TeleIn { + @Parameter + private List parameters = new ArrayList(); +} diff --git a/src/main/java/com/graywolf336/jail/command/jcommands/TeleOut.java b/src/main/java/com/graywolf336/jail/command/jcommands/TeleOut.java new file mode 100644 index 0000000..d49d5e7 --- /dev/null +++ b/src/main/java/com/graywolf336/jail/command/jcommands/TeleOut.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 = "Teleports the player to the teleport out location.") +public class TeleOut { + @Parameter + private List parameters = new ArrayList(); +} diff --git a/src/main/java/com/graywolf336/jail/command/commands/JailStopCommand.java b/src/main/java/com/graywolf336/jail/command/subcommands/JailStopCommand.java similarity index 89% rename from src/main/java/com/graywolf336/jail/command/commands/JailStopCommand.java rename to src/main/java/com/graywolf336/jail/command/subcommands/JailStopCommand.java index 0c3aec8..c822c2c 100644 --- a/src/main/java/com/graywolf336/jail/command/commands/JailStopCommand.java +++ b/src/main/java/com/graywolf336/jail/command/subcommands/JailStopCommand.java @@ -1,4 +1,4 @@ -package com.graywolf336.jail.command.commands; +package com.graywolf336.jail.command.subcommands; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -11,9 +11,9 @@ import com.graywolf336.jail.command.CommandInfo; maxArgs = 0, minimumArgs = 0, needsPlayer = true, - pattern = "jailstop", + pattern = "stop|s", permission = "jail.command.jailstop", - usage = "/jailstop" + usage = "/jail stop" ) public class JailStopCommand implements Command { public boolean execute(JailManager jm, CommandSender sender, String... args) { diff --git a/src/main/java/com/graywolf336/jail/command/commands/JailTeleInCommand.java b/src/main/java/com/graywolf336/jail/command/subcommands/JailTeleInCommand.java similarity index 90% rename from src/main/java/com/graywolf336/jail/command/commands/JailTeleInCommand.java rename to src/main/java/com/graywolf336/jail/command/subcommands/JailTeleInCommand.java index 41780f9..d99fe97 100644 --- a/src/main/java/com/graywolf336/jail/command/commands/JailTeleInCommand.java +++ b/src/main/java/com/graywolf336/jail/command/subcommands/JailTeleInCommand.java @@ -1,4 +1,4 @@ -package com.graywolf336.jail.command.commands; +package com.graywolf336.jail.command.subcommands; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -13,9 +13,9 @@ import com.graywolf336.jail.enums.LangString; maxArgs = 2, minimumArgs = 1, needsPlayer = false, - pattern = "jailtelein|jailteleportin", + pattern = "telein|teleportin", permission = "jail.command.jailtelein", - usage = "/jailtelein (player)" + usage = "/jail telein (player)" ) public class JailTeleInCommand implements Command { public boolean execute(JailManager jm, CommandSender sender, String... args) throws Exception { diff --git a/src/main/java/com/graywolf336/jail/command/commands/JailTeleOutCommand.java b/src/main/java/com/graywolf336/jail/command/subcommands/JailTeleOutCommand.java similarity index 90% rename from src/main/java/com/graywolf336/jail/command/commands/JailTeleOutCommand.java rename to src/main/java/com/graywolf336/jail/command/subcommands/JailTeleOutCommand.java index b30247d..b4eb761 100644 --- a/src/main/java/com/graywolf336/jail/command/commands/JailTeleOutCommand.java +++ b/src/main/java/com/graywolf336/jail/command/subcommands/JailTeleOutCommand.java @@ -1,4 +1,4 @@ -package com.graywolf336.jail.command.commands; +package com.graywolf336.jail.command.subcommands; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -13,9 +13,9 @@ import com.graywolf336.jail.enums.LangString; maxArgs = 2, minimumArgs = 1, needsPlayer = false, - pattern = "jailteleout|jailteleportout", + pattern = "teleout|teleportout", permission = "jail.command.jailteleout", - usage = "/jailteleout (player)" + usage = "/jail teleout (player)" ) public class JailTeleOutCommand implements Command { public boolean execute(JailManager jm, CommandSender sender, String... args) throws Exception {