Updated command classes to use better shortcut commands. (Issue #21)

This commit is contained in:
Tobias Ottenweller 2013-06-19 17:17:56 +02:00
parent 7a8e61104a
commit e9c4583c3d
10 changed files with 36 additions and 38 deletions

View File

@ -130,17 +130,17 @@ public class Plugin extends JavaPlugin
// Add the commands
commands.add(new CommandHelp());
commands.add(new CommandCreate());
commands.add(new CommandDelete());
commands.add(new CommandSetLocation());
commands.add(new CommandSetExit());
commands.add(new CommandNew());
commands.add(new CommandRemove());
commands.add(new CommandLocation());
commands.add(new CommandExit());
commands.add(new CommandOpen());
commands.add(new CommandRename());
commands.add(new CommandClose());
commands.add(new CommandList());
commands.add(new CommandInfo());
commands.add(new CommandSetHidden());
commands.add(new CommandSetVisible());
commands.add(new CommandHide());
commands.add(new CommandUnhide());
// Register events

View File

@ -24,10 +24,9 @@ import org.bukkit.ChatColor;
import de.craftinc.gates.Plugin;
public class CommandSetExit extends BaseCommand
public class CommandExit extends BaseCommand
{
public CommandSetExit()
public CommandExit()
{
aliases.add("exit");
aliases.add("e");

View File

@ -33,17 +33,17 @@ public class CommandHelp extends BaseCommand
List<String> allUsageStrings = new ArrayList<String>();
allUsageStrings.add( new CommandHelp().getUsageTemplate(true, true) );
allUsageStrings.add( new CommandCreate().getUsageTemplate(true, true) );
allUsageStrings.add( new CommandDelete().getUsageTemplate(true, true) );
allUsageStrings.add( new CommandSetLocation().getUsageTemplate(true, true) );
allUsageStrings.add( new CommandSetExit().getUsageTemplate(true, true) );
allUsageStrings.add( new CommandNew().getUsageTemplate(true, true) );
allUsageStrings.add( new CommandRemove().getUsageTemplate(true, true) );
allUsageStrings.add( new CommandLocation().getUsageTemplate(true, true) );
allUsageStrings.add( new CommandExit().getUsageTemplate(true, true) );
allUsageStrings.add( new CommandOpen().getUsageTemplate(true, true) );
allUsageStrings.add( new CommandRename().getUsageTemplate(true, true) );
allUsageStrings.add( new CommandClose().getUsageTemplate(true, true) );
allUsageStrings.add( new CommandList().getUsageTemplate(true, true) );
allUsageStrings.add( new CommandInfo().getUsageTemplate(true, true) );
allUsageStrings.add( new CommandSetHidden().getUsageTemplate(true, true) );
allUsageStrings.add( new CommandSetVisible().getUsageTemplate(true, true) );
allUsageStrings.add( new CommandHide().getUsageTemplate(true, true) );
allUsageStrings.add( new CommandUnhide().getUsageTemplate(true, true) );
Collections.sort(allUsageStrings);

View File

@ -24,11 +24,12 @@ import org.bukkit.ChatColor;
import de.craftinc.gates.Plugin;
public class CommandSetHidden extends BaseCommand
public class CommandHide extends BaseCommand
{
public CommandSetHidden()
public CommandHide()
{
aliases.add("hide");
aliases.add("h");
requiredParameters.add("id");

View File

@ -28,9 +28,7 @@ public class CommandInfo extends BaseCommand
public CommandInfo()
{
aliases.add("info");
aliases.add("details");
aliases.add("i");
aliases.add("d");
requiredParameters.add("id");

View File

@ -25,15 +25,16 @@ import org.bukkit.ChatColor;
import org.bukkit.Location;
import de.craftinc.gates.Plugin;
import org.bukkit.block.Block;
public class CommandSetLocation extends BaseLocationCommand
public class CommandLocation extends BaseLocationCommand
{
public CommandSetLocation()
public CommandLocation()
{
aliases.add("location");
aliases.add("l");
aliases.add("lo");
requiredParameters.add("id");
@ -61,9 +62,10 @@ public class CommandSetLocation extends BaseLocationCommand
{
Location oldLocation = gate.getLocation();
Set<Location> oldGateBlockLocations = gate.getGateBlockLocations();
Set<Block> oldFrameBlocks = gate.getGateFrameBlocks();
gate.setLocation(playerLocation);
Plugin.getPlugin().getGatesManager().handleGateLocationChange(gate, oldLocation, oldGateBlockLocations);
Plugin.getPlugin().getGatesManager().handleGateLocationChange(gate, oldLocation, oldGateBlockLocations, oldFrameBlocks);
sendMessage(ChatColor.GREEN + "The location of '" + gate.getId() + "' is now at your current location.");
}

View File

@ -24,12 +24,12 @@ import de.craftinc.gates.GatesManager;
import de.craftinc.gates.Plugin;
public class CommandCreate extends BaseLocationCommand
public class CommandNew extends BaseLocationCommand
{
public CommandCreate()
public CommandNew()
{
aliases.add("create");
aliases.add("new");
aliases.add("n");
requiredParameters.add("id");
@ -75,7 +75,7 @@ public class CommandCreate extends BaseLocationCommand
else
{
sendMessage("Now you should build a frame and execute:");
sendMessage(new CommandSetLocation().getUsageTemplate(true, true));
sendMessage(new CommandLocation().getUsageTemplate(true, true));
}
}
}

View File

@ -22,14 +22,13 @@ import org.bukkit.ChatColor;
import de.craftinc.gates.Plugin;
public class CommandDelete extends BaseCommand
public class CommandRemove extends BaseCommand
{
public CommandDelete()
public CommandRemove()
{
aliases.add("delete");
aliases.add("del");
aliases.add("remove");
aliases.add("rm");
requiredParameters.add("id");

View File

@ -27,8 +27,7 @@ public class CommandRename extends BaseCommand
public CommandRename()
{
aliases.add("rename");
aliases.add("changename");
aliases.add("cn");
aliases.add("rn");
hasGateParam = true;
senderMustBePlayer = false;

View File

@ -21,13 +21,13 @@ import org.bukkit.ChatColor;
import de.craftinc.gates.Plugin;
public class CommandSetVisible extends BaseCommand
public class CommandUnhide extends BaseCommand
{
public CommandSetVisible()
public CommandUnhide()
{
aliases.add("unhide");
aliases.add("uh");
aliases.add("u");
requiredParameters.add("id");