diff --git a/src/main/java/de/craftinc/borderprotection/Commands.java b/src/main/java/de/craftinc/borderprotection/Commands.java deleted file mode 100644 index c3d442c..0000000 --- a/src/main/java/de/craftinc/borderprotection/Commands.java +++ /dev/null @@ -1,236 +0,0 @@ -/* Craft Inc. BorderProtection - Copyright (C) 2013 Paul Schulze, Tobias Ottenweller - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ -package de.craftinc.borderprotection; - -import de.craftinc.borderprotection.borders.Border; -import de.craftinc.borderprotection.borders.CircBorder; -import de.craftinc.borderprotection.borders.RectBorder; -import de.craftinc.borderprotection.util.UpdateHelper; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import java.io.IOException; - -public class Commands implements CommandExecutor -{ - @Override - public boolean onCommand( CommandSender sender, Command command, String label, String[] args ) - { - // Check if command comes from a player. - if ( !( sender instanceof Player ) ) - { - sender.sendMessage(Messages.commandIssuedByNonPlayer); - return true; - } - - // command for all actions - if ( command.getName().equalsIgnoreCase("cibp") ) - { - // help - if ( args.length == 0 || ( args.length > 0 && args[0].equalsIgnoreCase("help") ) ) - { - sender.sendMessage(Messages.helpGeneral); - return true; - } - - // checkversion - if ( args.length > 0 && args[0].equalsIgnoreCase("checkversion") ) - { - if ( !sender.hasPermission("craftinc.borderprotection.update") ) - { - sender.sendMessage(Messages.noPermissionCheckversion); - return false; - } - - if ( UpdateHelper.newVersionAvailable() ) - { - sender.sendMessage( - Messages.updateMessage(UpdateHelper.cachedLatestVersion, UpdateHelper.getCurrentVersion())); - return true; - } - else - { - sender.sendMessage(Messages.noUpdateAvailable); - return true; - } - - } - - // set - if ( ( args.length == 3 || args.length == 4 ) && args[0].equalsIgnoreCase("set") ) - { - if ( !sender.hasPermission("craftinc.borderprotection.set") ) - { - sender.sendMessage(Messages.noPermissionSet); - return false; - } - World world = ( (Player) sender ).getWorld(); - - // set [r|c] - if ( args.length == 3 ) - { - try - { - Double distance = Double.parseDouble(args[2]); - Border newBorder = null; - - // rect border - if ( args[1].equalsIgnoreCase("r") ) - { - newBorder = new RectBorder(new Location(world, distance, 0, distance), - new Location(world, -distance, 0, -distance)); - } - // circ border - else if ( args[1].equalsIgnoreCase("c") ) - { - newBorder = new CircBorder(new Location(world, 0, 0, 0), distance); - } - - if ( newBorder != null ) - { - sender.sendMessage(Messages.borderCreationSuccessful); - sender.sendMessage( - Messages.borderInfo(world.getName(), newBorder)); - } - } - catch ( Exception e ) - { - sender.sendMessage(e.getMessage()); - } - } - // set r | set c
- else - { - try - { - Border newBorder = null; - - // rect border - if ( args[1].equalsIgnoreCase("r") ) - { - Double p1X = Double.parseDouble(args[2].split(",")[0]); - Double p1Z = Double.parseDouble(args[2].split(",")[1]); - Double p2X = Double.parseDouble(args[3].split(",")[0]); - Double p2Z = Double.parseDouble(args[3].split(",")[1]); - - newBorder = new RectBorder(new Location(world, p1X, 0, p1Z), - new Location(world, p2X, 0, p2Z)); - } - // circ border - else if ( args[1].equalsIgnoreCase("c") ) - { - Double centerX = Double.parseDouble(args[2].split(",")[0]); - Double centerZ = Double.parseDouble(args[2].split(",")[1]); - Double radius = Double.parseDouble(args[3]); - - newBorder = new CircBorder(new Location(world, centerX, 0, centerZ), radius); - } - - if ( newBorder != null ) - { - sender.sendMessage(Messages.borderCreationSuccessful); - sender.sendMessage( - Messages.borderInfo(world.getName(), newBorder)); - } - } - catch ( Exception e ) - { - sender.sendMessage(e.getMessage()); - } - } - - // save the new border - try - { - Border.saveBorders(); - } - catch ( IOException e ) - { - sender.sendMessage(Messages.borderSaveException); - } - return true; - } - - // get - if ( args.length == 1 && ( args[0].equalsIgnoreCase("get") || args[0].equalsIgnoreCase("info") ) ) - { - World world = ( (Player) sender ).getWorld(); - - // exit and send the player a message if no border is set - if ( !Border.getBorders().containsKey(world) ) - { - sender.sendMessage(Messages.borderInfoNoBorderSet); - return true; - } - - Border border = Border.getBorders().get(world); - - sender.sendMessage(Messages.borderInfo(world.getName(), border)); - return true; - } - - // on - if ( args.length == 1 && ( args[0].equalsIgnoreCase("on") || args[0].equalsIgnoreCase("off") ) ) - { - if ( !sender.hasPermission("craftinc.borderprotection.set") ) - { - sender.sendMessage(Messages.noPermissionSet); - return false; - } - - World world = ( (Player) sender ).getWorld(); - Border border = Border.getBorders().get(world); - - if ( border != null ) - { - if ( args[0].equalsIgnoreCase("on") ) - { - border.enable(); - sender.sendMessage(Messages.borderEnabled); - } - else - { - border.disable(); - sender.sendMessage(Messages.borderDisabled); - } - } - else - { - sender.sendMessage(Messages.borderInfoNoBorderSet); - } - - // save the changed border - try - { - Border.saveBorders(); - } - catch ( IOException e ) - { - sender.sendMessage(Messages.borderEnableDisableException); - } - return true; - } - } - - sender.sendMessage(Messages.helpGeneral); - return false; - } -} diff --git a/src/main/java/de/craftinc/borderprotection/Messages.java b/src/main/java/de/craftinc/borderprotection/Messages.java index d6e8faa..bbc369b 100644 --- a/src/main/java/de/craftinc/borderprotection/Messages.java +++ b/src/main/java/de/craftinc/borderprotection/Messages.java @@ -84,6 +84,7 @@ public class Messages ChatColor.WHITE + "Commands are always related to the current world." + NEWLINE + makeCmd("help", "shows this help") + makeCmd("get | info", "Shows information about the border.") + + makeCmd("generate", "Generate all chunks inside the border", "on | off") + makeCmd("on | off", "Enables/disables the border.") + makeCmd("set", "Square border with distance (d) from 0,0.", "r", "") + makeCmd("set", "Rectangle defined by two points. Point=x,z.", "r", "", "") + diff --git a/src/main/java/de/craftinc/borderprotection/Plugin.java b/src/main/java/de/craftinc/borderprotection/Plugin.java index e3e4aac..5c7f201 100644 --- a/src/main/java/de/craftinc/borderprotection/Plugin.java +++ b/src/main/java/de/craftinc/borderprotection/Plugin.java @@ -18,6 +18,7 @@ package de.craftinc.borderprotection; import de.craftinc.borderprotection.borders.CircBorder; import de.craftinc.borderprotection.borders.RectBorder; +import de.craftinc.borderprotection.commands.CommandSwitch; import de.craftinc.borderprotection.events.PlayerLoginListener; import de.craftinc.borderprotection.events.PlayerMoveListener; import de.craftinc.borderprotection.events.PlayerTeleportListener; @@ -52,7 +53,7 @@ public class Plugin extends JavaPlugin PlayerLoginListener playerLoginListener = new PlayerLoginListener(); // commands - Commands commandExecutor = new Commands(); + CommandSwitch commandExecutor = new CommandSwitch(); getCommand("cibp").setExecutor(commandExecutor); // register listeners diff --git a/src/main/java/de/craftinc/borderprotection/commands/CheckVersionCommand.java b/src/main/java/de/craftinc/borderprotection/commands/CheckVersionCommand.java new file mode 100644 index 0000000..279eac7 --- /dev/null +++ b/src/main/java/de/craftinc/borderprotection/commands/CheckVersionCommand.java @@ -0,0 +1,58 @@ +/* Craft Inc. BorderProtection + Copyright (C) 2013 Paul Schulze + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +package de.craftinc.borderprotection.commands; + +import de.craftinc.borderprotection.Messages; +import de.craftinc.borderprotection.util.UpdateHelper; +import org.bukkit.command.CommandSender; + +import java.util.ArrayList; +import java.util.List; + +public class CheckVersionCommand implements SubCommand +{ + @Override + public boolean execute(CommandSender sender, String[] parameters) + { + if ( !sender.hasPermission("craftinc.borderprotection.update") ) + { + sender.sendMessage(Messages.noPermissionCheckversion); + return false; + } + + if ( UpdateHelper.newVersionAvailable() ) + { + sender.sendMessage( + Messages.updateMessage(UpdateHelper.cachedLatestVersion, UpdateHelper.getCurrentVersion())); + return true; + } + else + { + sender.sendMessage(Messages.noUpdateAvailable); + return true; + } + } + + @Override + public List commandNames() + { + ArrayList names = new ArrayList(); + names.add("checkversion"); + + return names; + } +} diff --git a/src/main/java/de/craftinc/borderprotection/commands/CommandSwitch.java b/src/main/java/de/craftinc/borderprotection/commands/CommandSwitch.java new file mode 100644 index 0000000..f110817 --- /dev/null +++ b/src/main/java/de/craftinc/borderprotection/commands/CommandSwitch.java @@ -0,0 +1,94 @@ +/* Craft Inc. BorderProtection + Copyright (C) 2013 Paul Schulze, Tobias Ottenweller + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +package de.craftinc.borderprotection.commands; + +import de.craftinc.borderprotection.Messages; +import de.craftinc.borderprotection.borders.Border; +import de.craftinc.borderprotection.borders.CircBorder; +import de.craftinc.borderprotection.borders.RectBorder; +import de.craftinc.borderprotection.util.UpdateHelper; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +public class CommandSwitch implements CommandExecutor +{ + protected Map subCommandsMap = new HashMap(); + + public CommandSwitch() + { + registerCommand(new CheckVersionCommand()); + registerCommand(new GenerateCommand()); + registerCommand(new GetCommand()); + registerCommand(new HelpCommand()); + registerCommand(new OnOffCommand()); + registerCommand(new SetCommand()); + } + + protected void registerCommand(SubCommand command) + { + for (String commandName : command.commandNames()) + { + subCommandsMap.put(commandName, command); + } + } + + @Override + public boolean onCommand( CommandSender sender, Command command, String label, String[] args ) + { + // Check if command comes from a player. + if ( !( sender instanceof Player ) ) + { + sender.sendMessage(Messages.commandIssuedByNonPlayer); + return true; + } + + boolean success = false; + + // command for all actions + if ( command.getName().equalsIgnoreCase("cibp") ) + { + if (args.length > 0) + { + String lowerCaseSubCommandName = args[0].toLowerCase(); + SubCommand subCommand = subCommandsMap.get(lowerCaseSubCommandName); + + if (subCommand != null) + { + success = subCommand.execute(sender, args); + } + } + + if (!success) + { + subCommandsMap.get("help").execute(sender, args); + } + + return success; + } + + return false; + } +} diff --git a/src/main/java/de/craftinc/borderprotection/commands/GenerateCommand.java b/src/main/java/de/craftinc/borderprotection/commands/GenerateCommand.java new file mode 100644 index 0000000..68e9421 --- /dev/null +++ b/src/main/java/de/craftinc/borderprotection/commands/GenerateCommand.java @@ -0,0 +1,49 @@ +/* Craft Inc. BorderProtection + Copyright (C) 2013 Paul Schulze + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +package de.craftinc.borderprotection.commands; + +import de.craftinc.borderprotection.Messages; +import org.bukkit.command.CommandSender; + +import java.util.ArrayList; +import java.util.List; + +public class GenerateCommand implements SubCommand +{ + @Override + public boolean execute(CommandSender sender, String[] parameters) + { + if ( !sender.hasPermission("craftinc.borderprotection.set") ) // TODO: a new/different permission? + { + sender.sendMessage(Messages.noPermissionSet); + return false; + } + + // TODO: implement me! + + return false; + } + + @Override + public List commandNames() + { + ArrayList names = new ArrayList(); + names.add("generate"); + + return names; + } +} diff --git a/src/main/java/de/craftinc/borderprotection/commands/GetCommand.java b/src/main/java/de/craftinc/borderprotection/commands/GetCommand.java new file mode 100644 index 0000000..fdb4da9 --- /dev/null +++ b/src/main/java/de/craftinc/borderprotection/commands/GetCommand.java @@ -0,0 +1,57 @@ +/* Craft Inc. BorderProtection + Copyright (C) 2013 Paul Schulze + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +package de.craftinc.borderprotection.commands; + +import de.craftinc.borderprotection.Messages; +import de.craftinc.borderprotection.borders.Border; +import org.bukkit.World; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.ArrayList; +import java.util.List; + +public class GetCommand implements SubCommand +{ + @Override + public boolean execute(CommandSender sender, String[] parameters) + { + World world = ( (Player) sender ).getWorld(); + + // exit and send the player a message if no border is set + if ( !Border.getBorders().containsKey(world) ) + { + sender.sendMessage(Messages.borderInfoNoBorderSet); + return true; + } + + Border border = Border.getBorders().get(world); + + sender.sendMessage(Messages.borderInfo(world.getName(), border)); + return true; + } + + @Override + public List commandNames() + { + ArrayList names = new ArrayList(); + names.add("get"); + names.add("info"); + + return names; + } +} diff --git a/src/main/java/de/craftinc/borderprotection/commands/HelpCommand.java b/src/main/java/de/craftinc/borderprotection/commands/HelpCommand.java new file mode 100644 index 0000000..448fcd5 --- /dev/null +++ b/src/main/java/de/craftinc/borderprotection/commands/HelpCommand.java @@ -0,0 +1,43 @@ +/* Craft Inc. BorderProtection + Copyright (C) 2013 Paul Schulze + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +package de.craftinc.borderprotection.commands; + +import de.craftinc.borderprotection.Messages; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; + +import java.util.ArrayList; +import java.util.List; + +public class HelpCommand implements SubCommand +{ + @Override + public boolean execute(CommandSender sender, String[] parameters) + { + sender.sendMessage(Messages.helpGeneral); + return true; + } + + @Override + public List commandNames() + { + ArrayList names = new ArrayList(); + names.add("help"); + + return names; + } +} diff --git a/src/main/java/de/craftinc/borderprotection/commands/OnOffCommand.java b/src/main/java/de/craftinc/borderprotection/commands/OnOffCommand.java new file mode 100644 index 0000000..0ec39f2 --- /dev/null +++ b/src/main/java/de/craftinc/borderprotection/commands/OnOffCommand.java @@ -0,0 +1,85 @@ +/* Craft Inc. BorderProtection + Copyright (C) 2013 Paul Schulze + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +package de.craftinc.borderprotection.commands; + + +import de.craftinc.borderprotection.Messages; +import de.craftinc.borderprotection.borders.Border; +import org.bukkit.World; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class OnOffCommand implements SubCommand +{ + @Override + public boolean execute(CommandSender sender, String[] parameters) + { + if ( !sender.hasPermission("craftinc.borderprotection.set") ) + { + sender.sendMessage(Messages.noPermissionSet); + return false; + } + + World world = ( (Player) sender ).getWorld(); + Border border = Border.getBorders().get(world); + + if ( border != null ) + { + if ( parameters[0].equalsIgnoreCase("on") ) + { + border.enable(); + sender.sendMessage(Messages.borderEnabled); + } + else + { + border.disable(); + sender.sendMessage(Messages.borderDisabled); + } + } + else + { + sender.sendMessage(Messages.borderInfoNoBorderSet); + } + + // save the changed border + try + { + Border.saveBorders(); + } + catch ( IOException e ) + { + sender.sendMessage(Messages.borderEnableDisableException); + } + + return true; + } + + @Override + public List commandNames() + { + ArrayList names = new ArrayList(); + names.add("on"); + names.add("off"); + + return names; + } +} diff --git a/src/main/java/de/craftinc/borderprotection/commands/SetCommand.java b/src/main/java/de/craftinc/borderprotection/commands/SetCommand.java new file mode 100644 index 0000000..935a642 --- /dev/null +++ b/src/main/java/de/craftinc/borderprotection/commands/SetCommand.java @@ -0,0 +1,144 @@ +/* Craft Inc. BorderProtection + Copyright (C) 2013 Paul Schulze + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +package de.craftinc.borderprotection.commands; + + +import de.craftinc.borderprotection.Messages; +import de.craftinc.borderprotection.borders.Border; +import de.craftinc.borderprotection.borders.CircBorder; +import de.craftinc.borderprotection.borders.RectBorder; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class SetCommand implements SubCommand +{ + @Override + public boolean execute(CommandSender sender, String[] parameters) + { + if ( !( parameters.length == 3 || parameters.length == 4 ) ) + { + return false; + } + + if ( !sender.hasPermission("craftinc.borderprotection.set") ) + { + sender.sendMessage(Messages.noPermissionSet); + return false; + } + + World world = ( (Player) sender ).getWorld(); + + // set [r|c] + if ( parameters.length == 3 ) + { + try + { + Double distance = Double.parseDouble(parameters[2]); + Border newBorder = null; + + // rect border + if ( parameters[1].equalsIgnoreCase("r") ) + { + newBorder = new RectBorder(new Location(world, distance, 0, distance), + new Location(world, -distance, 0, -distance)); + } + // circ border + else if ( parameters[1].equalsIgnoreCase("c") ) + { + newBorder = new CircBorder(new Location(world, 0, 0, 0), distance); + } + + if ( newBorder != null ) + { + sender.sendMessage(Messages.borderCreationSuccessful); + sender.sendMessage( + Messages.borderInfo(world.getName(), newBorder)); + } + } + catch ( Exception e ) + { + sender.sendMessage(e.getMessage()); + } + } + // set r | set c
+ else + { + try + { + Border newBorder = null; + + // rect border + if ( parameters[1].equalsIgnoreCase("r") ) + { + Double p1X = Double.parseDouble(parameters[2].split(",")[0]); + Double p1Z = Double.parseDouble(parameters[2].split(",")[1]); + Double p2X = Double.parseDouble(parameters[3].split(",")[0]); + Double p2Z = Double.parseDouble(parameters[3].split(",")[1]); + + newBorder = new RectBorder(new Location(world, p1X, 0, p1Z), + new Location(world, p2X, 0, p2Z)); + } + // circ border + else if ( parameters[1].equalsIgnoreCase("c") ) + { + Double centerX = Double.parseDouble(parameters[2].split(",")[0]); + Double centerZ = Double.parseDouble(parameters[2].split(",")[1]); + Double radius = Double.parseDouble(parameters[3]); + + newBorder = new CircBorder(new Location(world, centerX, 0, centerZ), radius); + } + + if ( newBorder != null ) + { + sender.sendMessage(Messages.borderCreationSuccessful); + sender.sendMessage( + Messages.borderInfo(world.getName(), newBorder)); + } + } + catch ( Exception e ) + { + sender.sendMessage(e.getMessage()); + } + } + + // save the new border + try + { + Border.saveBorders(); + } + catch ( IOException e ) + { + sender.sendMessage(Messages.borderSaveException); + } + return true; + } + + @Override + public List commandNames() + { + ArrayList names = new ArrayList(); + names.add("set"); + + return names; + } +} diff --git a/src/main/java/de/craftinc/borderprotection/commands/SubCommand.java b/src/main/java/de/craftinc/borderprotection/commands/SubCommand.java new file mode 100644 index 0000000..0a62364 --- /dev/null +++ b/src/main/java/de/craftinc/borderprotection/commands/SubCommand.java @@ -0,0 +1,40 @@ +/* Craft Inc. BorderProtection + Copyright (C) 2013 Paul Schulze + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +package de.craftinc.borderprotection.commands; + + +import org.bukkit.command.CommandSender; + +import java.util.List; + + +public interface SubCommand +{ + /** + * + * @param sender will contain the command name at index 0. + * @param parameters + * @return + */ + public boolean execute(CommandSender sender, String[] parameters); + + /** + * + * @return a list of names of the command. All strings should be lowercase! + */ + public List commandNames(); +}