Updated command classes to use better shortcut commands. (Issue #21)
This commit is contained in:
parent
7a8e61104a
commit
e9c4583c3d
@ -130,17 +130,17 @@ public class Plugin extends JavaPlugin
|
|||||||
|
|
||||||
// Add the commands
|
// Add the commands
|
||||||
commands.add(new CommandHelp());
|
commands.add(new CommandHelp());
|
||||||
commands.add(new CommandCreate());
|
commands.add(new CommandNew());
|
||||||
commands.add(new CommandDelete());
|
commands.add(new CommandRemove());
|
||||||
commands.add(new CommandSetLocation());
|
commands.add(new CommandLocation());
|
||||||
commands.add(new CommandSetExit());
|
commands.add(new CommandExit());
|
||||||
commands.add(new CommandOpen());
|
commands.add(new CommandOpen());
|
||||||
commands.add(new CommandRename());
|
commands.add(new CommandRename());
|
||||||
commands.add(new CommandClose());
|
commands.add(new CommandClose());
|
||||||
commands.add(new CommandList());
|
commands.add(new CommandList());
|
||||||
commands.add(new CommandInfo());
|
commands.add(new CommandInfo());
|
||||||
commands.add(new CommandSetHidden());
|
commands.add(new CommandHide());
|
||||||
commands.add(new CommandSetVisible());
|
commands.add(new CommandUnhide());
|
||||||
|
|
||||||
|
|
||||||
// Register events
|
// Register events
|
||||||
|
@ -24,10 +24,9 @@ import org.bukkit.ChatColor;
|
|||||||
import de.craftinc.gates.Plugin;
|
import de.craftinc.gates.Plugin;
|
||||||
|
|
||||||
|
|
||||||
public class CommandSetExit extends BaseCommand
|
public class CommandExit extends BaseCommand
|
||||||
{
|
{
|
||||||
|
public CommandExit()
|
||||||
public CommandSetExit()
|
|
||||||
{
|
{
|
||||||
aliases.add("exit");
|
aliases.add("exit");
|
||||||
aliases.add("e");
|
aliases.add("e");
|
@ -33,17 +33,17 @@ public class CommandHelp extends BaseCommand
|
|||||||
List<String> allUsageStrings = new ArrayList<String>();
|
List<String> allUsageStrings = new ArrayList<String>();
|
||||||
|
|
||||||
allUsageStrings.add( new CommandHelp().getUsageTemplate(true, true) );
|
allUsageStrings.add( new CommandHelp().getUsageTemplate(true, true) );
|
||||||
allUsageStrings.add( new CommandCreate().getUsageTemplate(true, true) );
|
allUsageStrings.add( new CommandNew().getUsageTemplate(true, true) );
|
||||||
allUsageStrings.add( new CommandDelete().getUsageTemplate(true, true) );
|
allUsageStrings.add( new CommandRemove().getUsageTemplate(true, true) );
|
||||||
allUsageStrings.add( new CommandSetLocation().getUsageTemplate(true, true) );
|
allUsageStrings.add( new CommandLocation().getUsageTemplate(true, true) );
|
||||||
allUsageStrings.add( new CommandSetExit().getUsageTemplate(true, true) );
|
allUsageStrings.add( new CommandExit().getUsageTemplate(true, true) );
|
||||||
allUsageStrings.add( new CommandOpen().getUsageTemplate(true, true) );
|
allUsageStrings.add( new CommandOpen().getUsageTemplate(true, true) );
|
||||||
allUsageStrings.add( new CommandRename().getUsageTemplate(true, true) );
|
allUsageStrings.add( new CommandRename().getUsageTemplate(true, true) );
|
||||||
allUsageStrings.add( new CommandClose().getUsageTemplate(true, true) );
|
allUsageStrings.add( new CommandClose().getUsageTemplate(true, true) );
|
||||||
allUsageStrings.add( new CommandList().getUsageTemplate(true, true) );
|
allUsageStrings.add( new CommandList().getUsageTemplate(true, true) );
|
||||||
allUsageStrings.add( new CommandInfo().getUsageTemplate(true, true) );
|
allUsageStrings.add( new CommandInfo().getUsageTemplate(true, true) );
|
||||||
allUsageStrings.add( new CommandSetHidden().getUsageTemplate(true, true) );
|
allUsageStrings.add( new CommandHide().getUsageTemplate(true, true) );
|
||||||
allUsageStrings.add( new CommandSetVisible().getUsageTemplate(true, true) );
|
allUsageStrings.add( new CommandUnhide().getUsageTemplate(true, true) );
|
||||||
|
|
||||||
Collections.sort(allUsageStrings);
|
Collections.sort(allUsageStrings);
|
||||||
|
|
||||||
|
@ -24,11 +24,12 @@ import org.bukkit.ChatColor;
|
|||||||
import de.craftinc.gates.Plugin;
|
import de.craftinc.gates.Plugin;
|
||||||
|
|
||||||
|
|
||||||
public class CommandSetHidden extends BaseCommand
|
public class CommandHide extends BaseCommand
|
||||||
{
|
{
|
||||||
public CommandSetHidden()
|
public CommandHide()
|
||||||
{
|
{
|
||||||
aliases.add("hide");
|
aliases.add("hide");
|
||||||
|
aliases.add("h");
|
||||||
|
|
||||||
requiredParameters.add("id");
|
requiredParameters.add("id");
|
||||||
|
|
@ -28,10 +28,8 @@ public class CommandInfo extends BaseCommand
|
|||||||
public CommandInfo()
|
public CommandInfo()
|
||||||
{
|
{
|
||||||
aliases.add("info");
|
aliases.add("info");
|
||||||
aliases.add("details");
|
|
||||||
aliases.add("i");
|
aliases.add("i");
|
||||||
aliases.add("d");
|
|
||||||
|
|
||||||
requiredParameters.add("id");
|
requiredParameters.add("id");
|
||||||
|
|
||||||
helpDescription = "Print detailed information about a certain gate.";
|
helpDescription = "Print detailed information about a certain gate.";
|
||||||
|
@ -25,15 +25,16 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
||||||
import de.craftinc.gates.Plugin;
|
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("location");
|
||||||
aliases.add("l");
|
aliases.add("lo");
|
||||||
|
|
||||||
requiredParameters.add("id");
|
requiredParameters.add("id");
|
||||||
|
|
||||||
@ -61,9 +62,10 @@ public class CommandSetLocation extends BaseLocationCommand
|
|||||||
{
|
{
|
||||||
Location oldLocation = gate.getLocation();
|
Location oldLocation = gate.getLocation();
|
||||||
Set<Location> oldGateBlockLocations = gate.getGateBlockLocations();
|
Set<Location> oldGateBlockLocations = gate.getGateBlockLocations();
|
||||||
|
Set<Block> oldFrameBlocks = gate.getGateFrameBlocks();
|
||||||
|
|
||||||
gate.setLocation(playerLocation);
|
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.");
|
sendMessage(ChatColor.GREEN + "The location of '" + gate.getId() + "' is now at your current location.");
|
||||||
}
|
}
|
@ -24,13 +24,13 @@ import de.craftinc.gates.GatesManager;
|
|||||||
import de.craftinc.gates.Plugin;
|
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("new");
|
||||||
|
aliases.add("n");
|
||||||
|
|
||||||
requiredParameters.add("id");
|
requiredParameters.add("id");
|
||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
@ -75,7 +75,7 @@ public class CommandCreate extends BaseLocationCommand
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
sendMessage("Now you should build a frame and execute:");
|
sendMessage("Now you should build a frame and execute:");
|
||||||
sendMessage(new CommandSetLocation().getUsageTemplate(true, true));
|
sendMessage(new CommandLocation().getUsageTemplate(true, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -22,14 +22,13 @@ import org.bukkit.ChatColor;
|
|||||||
import de.craftinc.gates.Plugin;
|
import de.craftinc.gates.Plugin;
|
||||||
|
|
||||||
|
|
||||||
public class CommandDelete extends BaseCommand
|
public class CommandRemove extends BaseCommand
|
||||||
{
|
{
|
||||||
public CommandDelete()
|
public CommandRemove()
|
||||||
{
|
{
|
||||||
aliases.add("delete");
|
aliases.add("delete");
|
||||||
aliases.add("del");
|
aliases.add("del");
|
||||||
aliases.add("remove");
|
aliases.add("remove");
|
||||||
aliases.add("rm");
|
|
||||||
|
|
||||||
requiredParameters.add("id");
|
requiredParameters.add("id");
|
||||||
|
|
@ -27,9 +27,8 @@ public class CommandRename extends BaseCommand
|
|||||||
public CommandRename()
|
public CommandRename()
|
||||||
{
|
{
|
||||||
aliases.add("rename");
|
aliases.add("rename");
|
||||||
aliases.add("changename");
|
aliases.add("rn");
|
||||||
aliases.add("cn");
|
|
||||||
|
|
||||||
hasGateParam = true;
|
hasGateParam = true;
|
||||||
senderMustBePlayer = false;
|
senderMustBePlayer = false;
|
||||||
|
|
||||||
|
@ -21,13 +21,13 @@ import org.bukkit.ChatColor;
|
|||||||
import de.craftinc.gates.Plugin;
|
import de.craftinc.gates.Plugin;
|
||||||
|
|
||||||
|
|
||||||
public class CommandSetVisible extends BaseCommand
|
public class CommandUnhide extends BaseCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
public CommandSetVisible()
|
public CommandUnhide()
|
||||||
{
|
{
|
||||||
aliases.add("unhide");
|
aliases.add("unhide");
|
||||||
aliases.add("uh");
|
aliases.add("u");
|
||||||
|
|
||||||
requiredParameters.add("id");
|
requiredParameters.add("id");
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user