diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Buy.java b/src/main/java/com/intellectualcrafters/plot/commands/Buy.java index 3b04c8687..f9e328034 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Buy.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Buy.java @@ -34,16 +34,24 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.MainUtil; -import com.plotsquared.bukkit.util.bukkit.UUIDHandler; - +import com.intellectualsites.commands.CommandDeclaration; +import com.intellectualsites.commands.callers.CommandCaller; +import com.plotsquared.bukkit.util.UUIDHandler; +@CommandDeclaration( + command = "buy", + aliases = {"b"}, + description = "Buy the plot you are standing on", + usage = "/plot buy", + permission = "plots.buy", + category = CommandCategory.CLAIMING, + requiredType = PlotPlayer.class +) public class Buy extends SubCommand { - public Buy() { - super(Command.BUY, "Buy the plot you are standing on", "b", CommandCategory.CLAIMING, true); - } @Override - public boolean execute(final PlotPlayer plr, final String... args) { + public boolean onCommand(final CommandCaller caller, final String ... args) { + final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller(); if (EconHandler.manager == null) { return sendMessage(plr, C.ECON_DISABLED); } diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Chat.java b/src/main/java/com/intellectualcrafters/plot/commands/Chat.java index 7b8a521af..0054a0c6f 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Chat.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Chat.java @@ -4,14 +4,22 @@ import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotWorld; +import com.intellectualsites.commands.CommandDeclaration; +import com.intellectualsites.commands.callers.CommandCaller; +@CommandDeclaration( + command = "chat", + description = "Toggle plto chant on or off", + usage = "/plot chat [on|off]", + permission = "plots.chat", + category = CommandCategory.ACTIONS, + requiredType = PlotPlayer.class +) public class Chat extends SubCommand { - public Chat() { - super(Command.CHAT, "Toggle plot chat on or off", "chat", CommandCategory.ACTIONS, true); - } @Override - public boolean execute(PlotPlayer plr, String... args) { + public boolean onCommand(final CommandCaller caller, final String ... args) { + final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller(); final String world = plr.getLocation().getWorld(); if (!PS.get().isPlotWorld(world)) { return !sendMessage(plr, C.NOT_IN_PLOT_WORLD); diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Claim.java b/src/main/java/com/intellectualcrafters/plot/commands/Claim.java index 1d618e537..4d937918a 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Claim.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Claim.java @@ -34,14 +34,19 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.SchematicHandler.Schematic; +import com.intellectualsites.commands.CommandDeclaration; +import com.intellectualsites.commands.callers.CommandCaller; -/** - * @author Citymonstret - */ +@CommandDeclaration( + command = "claim", + aliases = {"c"}, + description = "Claim the current plot you're standing on", + category = CommandCategory.CLAIMING, + requiredType = PlotPlayer.class, + permission = "plots.claim", + usage = "/plot claim" +) public class Claim extends SubCommand { - public Claim() { - super(Command.CLAIM, "Claim the current plot you're standing on.", "claim", CommandCategory.CLAIMING, true); - } public static boolean claimPlot(final PlotPlayer player, final Plot plot, final boolean teleport, final boolean auto) { return claimPlot(player, plot, teleport, "", auto); @@ -91,7 +96,8 @@ public class Claim extends SubCommand { } @Override - public boolean execute(final PlotPlayer plr, final String... args) { + public boolean onCommand(final CommandCaller caller, final String ... args) { + final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller(); String schematic = ""; if (args.length >= 1) { schematic = args[0]; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Clear.java b/src/main/java/com/intellectualcrafters/plot/commands/Clear.java index ddc560b10..1db2d4465 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Clear.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Clear.java @@ -23,6 +23,7 @@ package com.intellectualcrafters.plot.commands; import java.util.Set; import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.object.Location; @@ -33,15 +34,22 @@ import com.intellectualcrafters.plot.util.CmdConfirm; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.TaskManager; -import com.plotsquared.bukkit.util.bukkit.UUIDHandler; +import com.intellectualsites.commands.CommandDeclaration; +import com.intellectualsites.commands.callers.CommandCaller; +import com.plotsquared.bukkit.util.UUIDHandler; +@CommandDeclaration( + command = "clear", + description = "Clear a plot", + permission = "plots.clear", + category = CommandCategory.ACTIONS, + usage = "/plot clear [id]" +) public class Clear extends SubCommand { - public Clear() { - super(Command.CLEAR, "Clear a plot", "clear", CommandCategory.ACTIONS, false); - } @Override - public boolean execute(final PlotPlayer plr, final String... args) { + public boolean onCommand(final CommandCaller caller, final String ... args) { + final PlotPlayer plr = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null; if (plr == null) { // Is console if (args.length < 2) { @@ -66,12 +74,7 @@ public class Clear extends SubCommand { PS.log("Plot " + plot.getId().toString() + " cleared."); } }; - if (Settings.CONFIRM_CLEAR && !(Permissions.hasPermission(plr, "plots.confirm.bypass"))) { - CmdConfirm.addPending(plr, "/plot clear " + id, runnable); - } - else { - TaskManager.runTask(runnable); - } + TaskManager.runTask(runnable); } } } diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java b/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java index b5c23e504..a2926dc53 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java @@ -27,6 +27,8 @@ import java.util.UUID; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; +import com.intellectualsites.commands.CommandDeclaration; +import com.intellectualsites.commands.callers.CommandCaller; import com.plotsquared.bukkit.generator.AugmentedPopulator; import com.plotsquared.bukkit.generator.HybridGen; import com.intellectualcrafters.plot.object.BlockLoc; @@ -34,22 +36,27 @@ import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotCluster; import com.intellectualcrafters.plot.object.PlotClusterId; -import com.plotsquared.bukkit.object.PlotGenerator; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.util.ClusterManager; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; -import com.plotsquared.bukkit.util.bukkit.UUIDHandler; +import com.plotsquared.bukkit.util.UUIDHandler; +@CommandDeclaration( + command = "cluser", + aliases = {"clusters"}, + category = CommandCategory.ACTIONS, + requiredType = PlotPlayer.class, + permission = "plots.cluster", + description = "Manage a plot cluster" +) public class Cluster extends SubCommand { - public Cluster() { - super(Command.CLUSTER, "Manage a plot cluster", "cluster", CommandCategory.ACTIONS, true); - } @Override - public boolean execute(final PlotPlayer plr, final String... args) { + public boolean onCommand(final CommandCaller caller, final String ... args) { + final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller(); // list, create, delete, resize, invite, kick, leave, helpers, tp, sethome if (args.length == 0) { // return arguments diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Copy.java b/src/main/java/com/intellectualcrafters/plot/commands/Copy.java index 996a744d4..289b39945 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Copy.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Copy.java @@ -27,24 +27,30 @@ import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; +import com.intellectualsites.commands.Argument; +import com.intellectualsites.commands.CommandDeclaration; +import com.intellectualsites.commands.callers.CommandCaller; -/** - * Created 2014-08-01 for PlotSquared - * - * @author Empire92 - */ +@CommandDeclaration( + command = "copy", + permission = "plots.copy", + aliases = {"copypaste"}, + category = CommandCategory.ACTIONS, + description = "Copy a plot", + usage = "/plot copy ", + requiredType = PlotPlayer.class +) public class Copy extends SubCommand { + public Copy() { - super("copy", "plots.copy", "Copy a plot", "copypaste", "", CommandCategory.ACTIONS, true); + requiredArguments = new Argument[] { + Argument.PlotID + }; } @Override - public boolean execute(final PlotPlayer plr, final String... args) { - if (args.length < 1) { - MainUtil.sendMessage(plr, C.NEED_PLOT_ID); - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot copy "); - return false; - } + public boolean onCommand(final CommandCaller caller, final String ... args) { + final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller(); final Location loc = plr.getLocation(); final Plot plot1 = MainUtil.getPlot(loc); if (plot1 == null) { diff --git a/src/main/java/com/intellectualcrafters/plot/commands/CreateRoadSchematic.java b/src/main/java/com/intellectualcrafters/plot/commands/CreateRoadSchematic.java index 781af514d..d5c3d3fa4 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/CreateRoadSchematic.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/CreateRoadSchematic.java @@ -28,6 +28,7 @@ import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualsites.commands.callers.CommandCaller; public class CreateRoadSchematic extends SubCommand { public CreateRoadSchematic() { @@ -35,7 +36,8 @@ public class CreateRoadSchematic extends SubCommand { } @Override - public boolean execute(final PlotPlayer player, final String... args) { + public boolean onCommand(final CommandCaller caller, final String ... args) { + final PlotPlayer player = (PlotPlayer) caller.getSuperCaller(); final Location loc = player.getLocation(); final Plot plot = MainUtil.getPlot(loc); if (plot == null) { diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugAllowUnsafe.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugAllowUnsafe.java index 80ab59ab3..5bc913960 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugAllowUnsafe.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugAllowUnsafe.java @@ -7,6 +7,7 @@ import java.util.UUID; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualsites.commands.callers.CommandCaller; public class DebugAllowUnsafe extends SubCommand { @@ -17,11 +18,8 @@ public class DebugAllowUnsafe extends SubCommand { } @Override - public boolean execute(final PlotPlayer plr, final String... args) { - if (plr == null) { - MainUtil.sendMessage(plr, C.IS_CONSOLE); - return false; - } + public boolean onCommand(final CommandCaller caller, final String ... args) { + final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller(); if (unsafeAllowed.contains(plr.getUUID())) { unsafeAllowed.remove(plr.getUUID()); sendMessage(plr, C.DEBUGALLOWUNSAFE_OFF); diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugFill.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugFill.java index 3684f29e5..07d6ce285 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugFill.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugFill.java @@ -29,6 +29,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.SetBlockQueue; import com.intellectualcrafters.plot.util.TaskManager; +import com.intellectualsites.commands.callers.CommandCaller; public class DebugFill extends SubCommand { public DebugFill() { @@ -36,7 +37,8 @@ public class DebugFill extends SubCommand { } @Override - public boolean execute(final PlotPlayer player, final String... args) { + public boolean onCommand(final CommandCaller caller, final String ... args) { + final PlotPlayer player = (PlotPlayer) caller.getSuperCaller(); if (args.length != 1 || (!args[0].equalsIgnoreCase("outline") && !args[0].equalsIgnoreCase("all"))) { MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot fill "); return true; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java index 862609aaa..e9c06dd12 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java @@ -28,6 +28,7 @@ import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualsites.commands.callers.CommandCaller; public class DebugRoadRegen extends SubCommand { public DebugRoadRegen() { @@ -35,7 +36,8 @@ public class DebugRoadRegen extends SubCommand { } @Override - public boolean execute(final PlotPlayer player, final String... args) { + public boolean onCommand(final CommandCaller caller, final String ... args) { + final PlotPlayer player = (PlotPlayer) caller.getSuperCaller(); final Location loc = player.getLocation(); final String world = loc.getWorld(); if (!(PS.get().getPlotWorld(world) instanceof HybridPlotWorld)) { diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugSetup.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugSetup.java index 5584a0a64..3f6bbd135 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugSetup.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugSetup.java @@ -22,22 +22,30 @@ package com.intellectualcrafters.plot.commands; import java.util.Map.Entry; +import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller; +import com.intellectualsites.commands.CommandDeclaration; +import com.intellectualsites.commands.callers.CommandCaller; import org.bukkit.generator.ChunkGenerator; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.ConfigurationNode; import com.plotsquared.bukkit.generator.HybridGen; -import com.plotsquared.bukkit.object.PlotGenerator; + import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.SetupObject; import com.intellectualcrafters.plot.util.MainUtil; import com.plotsquared.bukkit.util.SetupUtils; +@CommandDeclaration( + command = "setup", + permission = "plots.admin.command.setup", + description = "Plotworld setup command", + usage = "/plot setup", + aliases = {"create"}, + category = CommandCategory.ACTIONS +) public class DebugSetup extends SubCommand { - public DebugSetup() { - super("setup", "plots.admin.command.setup", "Plotworld setup command", "setup", "create", CommandCategory.ACTIONS, false); - } - + public void displayGenerators(PlotPlayer plr) { StringBuffer message = new StringBuffer(); message.append("&6What generator do you want?"); @@ -59,7 +67,8 @@ public class DebugSetup extends SubCommand { } @Override - public boolean execute(final PlotPlayer plr, final String... args) { + public boolean onCommand(final CommandCaller caller, final String ... args) { + final PlotPlayer plr = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null; // going through setup String name; if (plr == null) { diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugUUID.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugUUID.java index 6f68fb0d7..56306dd0f 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugUUID.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugUUID.java @@ -31,6 +31,7 @@ import java.util.UUID; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.callers.CommandCaller; +import com.plotsquared.bukkit.util.UUIDHandler; import org.bukkit.Bukkit; import com.intellectualcrafters.plot.PS; @@ -45,7 +46,7 @@ import com.intellectualcrafters.plot.object.StringWrapper; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.PlayerManager; import com.intellectualcrafters.plot.util.TaskManager; -import com.plotsquared.bukkit.util.bukkit.UUIDHandler; + import com.intellectualcrafters.plot.uuid.DefaultUUIDWrapper; import com.intellectualcrafters.plot.uuid.LowerOfflineUUIDWrapper; import com.intellectualcrafters.plot.uuid.OfflineUUIDWrapper; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Delete.java b/src/main/java/com/intellectualcrafters/plot/commands/Delete.java index 03af02c39..211d111f2 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Delete.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Delete.java @@ -35,7 +35,6 @@ import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.callers.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; -import com.plotsquared.bukkit.util.bukkit.UUIDHandler; @CommandDeclaration( command = "delete", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Deny.java b/src/main/java/com/intellectualcrafters/plot/commands/Deny.java index b6e7e740d..fe7b90e1d 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Deny.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Deny.java @@ -34,8 +34,8 @@ import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.callers.CommandCaller; -import com.plotsquared.bukkit.util.bukkit.UUIDHandler; +import com.plotsquared.bukkit.util.UUIDHandler; import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler; @CommandDeclaration( diff --git a/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java b/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java index 7c5f6be60..cd2a038d9 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java @@ -24,6 +24,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; +import com.intellectualsites.commands.CommandDeclaration; +import com.intellectualsites.commands.callers.CommandCaller; import org.apache.commons.lang.StringUtils; import com.intellectualcrafters.plot.config.C; @@ -38,13 +40,19 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; +@CommandDeclaration( + command = "flag", + aliases = {"f"}, + description = "Manage plot flags", + category = CommandCategory.ACTIONS, + requiredType = PlotPlayer.class, + permission = "plots.flag" +) public class FlagCmd extends SubCommand { - public FlagCmd() { - super(Command.FLAG, "Manage plot flags", "f", CommandCategory.ACTIONS, true); - } @Override - public boolean execute(final PlotPlayer player, final String... args) { + public boolean onCommand(final CommandCaller caller, final String ... args) { + final PlotPlayer player = (PlotPlayer) caller.getSuperCaller(); /* * plot flag set fly true * plot flag remove fly diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Info.java b/src/main/java/com/intellectualcrafters/plot/commands/Info.java index 892c0e378..aa6bf71b8 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Info.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Info.java @@ -29,6 +29,7 @@ import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller; import com.intellectualcrafters.plot.flag.Flag; import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.callers.CommandCaller; +import com.plotsquared.bukkit.util.UUIDHandler; import org.apache.commons.lang.StringUtils; import com.intellectualcrafters.plot.config.C; @@ -44,7 +45,6 @@ import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.TaskManager; -import com.plotsquared.bukkit.util.bukkit.UUIDHandler; @CommandDeclaration( command = "info", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Kick.java b/src/main/java/com/intellectualcrafters/plot/commands/Kick.java index ce4927ed5..4ce1a7bf6 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Kick.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Kick.java @@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.callers.CommandCaller; -import com.plotsquared.bukkit.util.bukkit.UUIDHandler; +import com.plotsquared.bukkit.util.UUIDHandler; @CommandDeclaration( command = "kick", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Purge.java b/src/main/java/com/intellectualcrafters/plot/commands/Purge.java index 4f7b7381a..b1ed17dda 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Purge.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Purge.java @@ -30,11 +30,11 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; -import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.callers.CommandCaller; -import com.plotsquared.bukkit.util.bukkit.UUIDHandler; +import com.plotsquared.bukkit.util.UUIDHandler; + @CommandDeclaration( command = "purge", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Remove.java b/src/main/java/com/intellectualcrafters/plot/commands/Remove.java index 85229325b..78d39ccf0 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Remove.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Remove.java @@ -33,7 +33,8 @@ import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.callers.CommandCaller; -import com.plotsquared.bukkit.util.bukkit.UUIDHandler; + +import com.plotsquared.bukkit.util.UUIDHandler; import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler; @CommandDeclaration( diff --git a/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java b/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java index 49bd1bf1d..7d4f3f7b7 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java @@ -27,6 +27,7 @@ import java.util.HashMap; import java.util.UUID; import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.object.Location; @@ -39,19 +40,29 @@ import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.SchematicHandler.Schematic; import com.intellectualcrafters.plot.util.TaskManager; +import com.intellectualsites.commands.CommandDeclaration; +import com.intellectualsites.commands.callers.CommandCaller; +// TODO Add sub-subcommands + +@CommandDeclaration( + command = "schematic", + permission = "plots.schematic", + description = "Schematic command", + aliases = {"sch"}, + category = CommandCategory.ACTIONS, + usage = "/plot schematic " +) public class SchematicCmd extends SubCommand { + private int counter = 0; private boolean running = false; private int task; - public SchematicCmd() { - super("schematic", "plots.schematic", "Schematic Command", "schematic {arg}", "sch", CommandCategory.ACTIONS, false); - // TODO command to fetch schematic from worldedit directory - } @Override - public boolean execute(final PlotPlayer plr, final String... args) { + public boolean onCommand(final CommandCaller caller, final String ... args) { + final PlotPlayer plr = caller instanceof PlotPlayerCaller ? (PlotPlayer) caller.getSuperCaller() : null; if (args.length < 1) { sendMessage(plr, C.SCHEMATIC_MISSING_ARG); return true; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Set.java b/src/main/java/com/intellectualcrafters/plot/commands/Set.java index 4a2bfa660..e2dd7ecb1 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Set.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Set.java @@ -24,6 +24,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import com.intellectualsites.commands.CommandDeclaration; +import com.intellectualsites.commands.callers.CommandCaller; +import com.plotsquared.bukkit.util.UUIDHandler; import org.apache.commons.lang.StringUtils; import com.intellectualcrafters.plot.PS; @@ -47,21 +50,25 @@ import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.SetBlockQueue; import com.intellectualcrafters.plot.util.StringComparison; import com.intellectualcrafters.plot.util.StringMan; -import com.plotsquared.bukkit.util.bukkit.UUIDHandler; -/** - * @author Citymonstret - */ + +// TODO Make sub-subcommands +@CommandDeclaration( + command = "set", + description = "Set a plot value", + aliases = {"s"}, + usage = "/plot set ", + permission = "plots.set", + category = CommandCategory.ACTIONS, + requiredType = PlotPlayer.class +) public class Set extends SubCommand { public final static String[] values = new String[] { "biome", "alias", "home", "flag" }; public final static String[] aliases = new String[] { "b", "w", "wf", "f", "a", "h", "fl" }; - public Set() { - super(Command.SET, "Set a plot value", "set {arg} {value...}", CommandCategory.ACTIONS, true); - } - @Override - public boolean execute(final PlotPlayer plr, final String... args) { + public boolean onCommand(final CommandCaller caller, final String ... args) { + final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller(); final Location loc = plr.getLocation(); final Plot plot = MainUtil.getPlot(loc); if (plot == null) { diff --git a/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java b/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java index ea35e823e..c3c739eba 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java @@ -36,7 +36,7 @@ import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.callers.CommandCaller; -import com.plotsquared.bukkit.util.bukkit.UUIDHandler; +import com.plotsquared.bukkit.util.UUIDHandler; @CommandDeclaration( command = "setowner", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/TP.java b/src/main/java/com/intellectualcrafters/plot/commands/TP.java index 0a9e536c1..0e1863a59 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/TP.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/TP.java @@ -23,6 +23,7 @@ package com.intellectualcrafters.plot.commands; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.callers.CommandCaller; +import com.plotsquared.bukkit.util.UUIDHandler; import org.apache.commons.lang.StringUtils; import com.intellectualcrafters.plot.PS; @@ -33,7 +34,6 @@ import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.MainUtil; -import com.plotsquared.bukkit.util.bukkit.UUIDHandler; @CommandDeclaration( command = "tp", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Trust.java b/src/main/java/com/intellectualcrafters/plot/commands/Trust.java index f4fd2f821..b6db5e452 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Trust.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Trust.java @@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.callers.CommandCaller; -import com.plotsquared.bukkit.util.bukkit.UUIDHandler; +import com.plotsquared.bukkit.util.UUIDHandler; import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler; @CommandDeclaration( diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java b/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java index aac546c78..1dac76e51 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java @@ -32,7 +32,8 @@ import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.callers.CommandCaller; -import com.plotsquared.bukkit.util.bukkit.UUIDHandler; + +import com.plotsquared.bukkit.util.UUIDHandler; import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler; @CommandDeclaration( diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Untrust.java b/src/main/java/com/intellectualcrafters/plot/commands/Untrust.java index 6f86c52f4..dfea00b4b 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Untrust.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Untrust.java @@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.callers.CommandCaller; -import com.plotsquared.bukkit.util.bukkit.UUIDHandler; +import com.plotsquared.bukkit.util.UUIDHandler; // UNTRUST("untrust", "ut"), diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Visit.java b/src/main/java/com/intellectualcrafters/plot/commands/Visit.java index 8d05273f4..2e918778c 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Visit.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Visit.java @@ -33,7 +33,7 @@ import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.callers.CommandCaller; -import com.plotsquared.bukkit.util.bukkit.UUIDHandler; +import com.plotsquared.bukkit.util.UUIDHandler; @CommandDeclaration( command = "visit", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/list.java b/src/main/java/com/intellectualcrafters/plot/commands/list.java index eff7b6075..f18fe9e5c 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/list.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/list.java @@ -32,6 +32,7 @@ import java.util.UUID; import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller; import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.callers.CommandCaller; +import com.plotsquared.bukkit.util.UUIDHandler; import org.apache.commons.lang.StringUtils; import org.bukkit.ChatColor; @@ -48,7 +49,7 @@ import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.StringComparison; -import com.plotsquared.bukkit.util.bukkit.UUIDHandler; + import com.plotsquared.bukkit.util.bukkit.chat.FancyMessage; @CommandDeclaration(