Continue fixing commands

This commit is contained in:
Sauilitired 2015-07-26 21:33:54 +02:00
parent e1c8dcc4be
commit 8ebcbda52b
28 changed files with 173 additions and 93 deletions

View File

@ -34,16 +34,24 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.EconHandler;
import com.intellectualcrafters.plot.util.MainUtil; 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 class Buy extends SubCommand {
public Buy() {
super(Command.BUY, "Buy the plot you are standing on", "b", CommandCategory.CLAIMING, true);
}
@Override @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) { if (EconHandler.manager == null) {
return sendMessage(plr, C.ECON_DISABLED); return sendMessage(plr, C.ECON_DISABLED);
} }

View File

@ -4,14 +4,22 @@ import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld; 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 class Chat extends SubCommand {
public Chat() {
super(Command.CHAT, "Toggle plot chat on or off", "chat", CommandCategory.ACTIONS, true);
}
@Override @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(); final String world = plr.getLocation().getWorld();
if (!PS.get().isPlotWorld(world)) { if (!PS.get().isPlotWorld(world)) {
return !sendMessage(plr, C.NOT_IN_PLOT_WORLD); return !sendMessage(plr, C.NOT_IN_PLOT_WORLD);

View File

@ -34,14 +34,19 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.SchematicHandler;
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic; import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
import com.intellectualsites.commands.CommandDeclaration;
import com.intellectualsites.commands.callers.CommandCaller;
/** @CommandDeclaration(
* @author Citymonstret 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 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) { public static boolean claimPlot(final PlotPlayer player, final Plot plot, final boolean teleport, final boolean auto) {
return claimPlot(player, plot, teleport, "", auto); return claimPlot(player, plot, teleport, "", auto);
@ -91,7 +96,8 @@ public class Claim extends SubCommand {
} }
@Override @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 = ""; String schematic = "";
if (args.length >= 1) { if (args.length >= 1) {
schematic = args[0]; schematic = args[0];

View File

@ -23,6 +23,7 @@ package com.intellectualcrafters.plot.commands;
import java.util.Set; import java.util.Set;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Location; 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.MainUtil;
import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.TaskManager; 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 class Clear extends SubCommand {
public Clear() {
super(Command.CLEAR, "Clear a plot", "clear", CommandCategory.ACTIONS, false);
}
@Override @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) { if (plr == null) {
// Is console // Is console
if (args.length < 2) { if (args.length < 2) {
@ -66,12 +74,7 @@ public class Clear extends SubCommand {
PS.log("Plot " + plot.getId().toString() + " cleared."); PS.log("Plot " + plot.getId().toString() + " cleared.");
} }
}; };
if (Settings.CONFIRM_CLEAR && !(Permissions.hasPermission(plr, "plots.confirm.bypass"))) { TaskManager.runTask(runnable);
CmdConfirm.addPending(plr, "/plot clear " + id, runnable);
}
else {
TaskManager.runTask(runnable);
}
} }
} }
} }

View File

@ -27,6 +27,8 @@ import java.util.UUID;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; 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.AugmentedPopulator;
import com.plotsquared.bukkit.generator.HybridGen; import com.plotsquared.bukkit.generator.HybridGen;
import com.intellectualcrafters.plot.object.BlockLoc; 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.Plot;
import com.intellectualcrafters.plot.object.PlotCluster; import com.intellectualcrafters.plot.object.PlotCluster;
import com.intellectualcrafters.plot.object.PlotClusterId; import com.intellectualcrafters.plot.object.PlotClusterId;
import com.plotsquared.bukkit.object.PlotGenerator;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.util.ClusterManager; import com.intellectualcrafters.plot.util.ClusterManager;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions; 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 class Cluster extends SubCommand {
public Cluster() {
super(Command.CLUSTER, "Manage a plot cluster", "cluster", CommandCategory.ACTIONS, true);
}
@Override @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 // list, create, delete, resize, invite, kick, leave, helpers, tp, sethome
if (args.length == 0) { if (args.length == 0) {
// return arguments // return arguments

View File

@ -27,24 +27,30 @@ import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualsites.commands.Argument;
import com.intellectualsites.commands.CommandDeclaration;
import com.intellectualsites.commands.callers.CommandCaller;
/** @CommandDeclaration(
* Created 2014-08-01 for PlotSquared command = "copy",
* permission = "plots.copy",
* @author Empire92 aliases = {"copypaste"},
*/ category = CommandCategory.ACTIONS,
description = "Copy a plot",
usage = "/plot copy <X;Z>",
requiredType = PlotPlayer.class
)
public class Copy extends SubCommand { public class Copy extends SubCommand {
public Copy() { public Copy() {
super("copy", "plots.copy", "Copy a plot", "copypaste", "", CommandCategory.ACTIONS, true); requiredArguments = new Argument[] {
Argument.PlotID
};
} }
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean onCommand(final CommandCaller caller, final String ... args) {
if (args.length < 1) { final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
MainUtil.sendMessage(plr, C.NEED_PLOT_ID);
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot copy <X;Z>");
return false;
}
final Location loc = plr.getLocation(); final Location loc = plr.getLocation();
final Plot plot1 = MainUtil.getPlot(loc); final Plot plot1 = MainUtil.getPlot(loc);
if (plot1 == null) { if (plot1 == null) {

View File

@ -28,6 +28,7 @@ import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualsites.commands.callers.CommandCaller;
public class CreateRoadSchematic extends SubCommand { public class CreateRoadSchematic extends SubCommand {
public CreateRoadSchematic() { public CreateRoadSchematic() {
@ -35,7 +36,8 @@ public class CreateRoadSchematic extends SubCommand {
} }
@Override @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 Location loc = player.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {

View File

@ -7,6 +7,7 @@ import java.util.UUID;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualsites.commands.callers.CommandCaller;
public class DebugAllowUnsafe extends SubCommand { public class DebugAllowUnsafe extends SubCommand {
@ -17,11 +18,8 @@ public class DebugAllowUnsafe extends SubCommand {
} }
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean onCommand(final CommandCaller caller, final String ... args) {
if (plr == null) { final PlotPlayer plr = (PlotPlayer) caller.getSuperCaller();
MainUtil.sendMessage(plr, C.IS_CONSOLE);
return false;
}
if (unsafeAllowed.contains(plr.getUUID())) { if (unsafeAllowed.contains(plr.getUUID())) {
unsafeAllowed.remove(plr.getUUID()); unsafeAllowed.remove(plr.getUUID());
sendMessage(plr, C.DEBUGALLOWUNSAFE_OFF); sendMessage(plr, C.DEBUGALLOWUNSAFE_OFF);

View File

@ -29,6 +29,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.SetBlockQueue; import com.intellectualcrafters.plot.util.SetBlockQueue;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualsites.commands.callers.CommandCaller;
public class DebugFill extends SubCommand { public class DebugFill extends SubCommand {
public DebugFill() { public DebugFill() {
@ -36,7 +37,8 @@ public class DebugFill extends SubCommand {
} }
@Override @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"))) { if (args.length != 1 || (!args[0].equalsIgnoreCase("outline") && !args[0].equalsIgnoreCase("all"))) {
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot fill <outline|all>"); MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot fill <outline|all>");
return true; return true;

View File

@ -28,6 +28,7 @@ import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualsites.commands.callers.CommandCaller;
public class DebugRoadRegen extends SubCommand { public class DebugRoadRegen extends SubCommand {
public DebugRoadRegen() { public DebugRoadRegen() {
@ -35,7 +36,8 @@ public class DebugRoadRegen extends SubCommand {
} }
@Override @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 Location loc = player.getLocation();
final String world = loc.getWorld(); final String world = loc.getWorld();
if (!(PS.get().getPlotWorld(world) instanceof HybridPlotWorld)) { if (!(PS.get().getPlotWorld(world) instanceof HybridPlotWorld)) {

View File

@ -22,21 +22,29 @@ package com.intellectualcrafters.plot.commands;
import java.util.Map.Entry; 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 org.bukkit.generator.ChunkGenerator;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.ConfigurationNode; import com.intellectualcrafters.plot.config.ConfigurationNode;
import com.plotsquared.bukkit.generator.HybridGen; import com.plotsquared.bukkit.generator.HybridGen;
import com.plotsquared.bukkit.object.PlotGenerator;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.SetupObject; import com.intellectualcrafters.plot.object.SetupObject;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.plotsquared.bukkit.util.SetupUtils; 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 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) { public void displayGenerators(PlotPlayer plr) {
StringBuffer message = new StringBuffer(); StringBuffer message = new StringBuffer();
@ -59,7 +67,8 @@ public class DebugSetup extends SubCommand {
} }
@Override @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 // going through setup
String name; String name;
if (plr == null) { if (plr == null) {

View File

@ -31,6 +31,7 @@ import java.util.UUID;
import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.Argument;
import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.CommandDeclaration;
import com.intellectualsites.commands.callers.CommandCaller; import com.intellectualsites.commands.callers.CommandCaller;
import com.plotsquared.bukkit.util.UUIDHandler;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import com.intellectualcrafters.plot.PS; 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.MainUtil;
import com.intellectualcrafters.plot.util.PlayerManager; import com.intellectualcrafters.plot.util.PlayerManager;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.bukkit.util.bukkit.UUIDHandler;
import com.intellectualcrafters.plot.uuid.DefaultUUIDWrapper; import com.intellectualcrafters.plot.uuid.DefaultUUIDWrapper;
import com.intellectualcrafters.plot.uuid.LowerOfflineUUIDWrapper; import com.intellectualcrafters.plot.uuid.LowerOfflineUUIDWrapper;
import com.intellectualcrafters.plot.uuid.OfflineUUIDWrapper; import com.intellectualcrafters.plot.uuid.OfflineUUIDWrapper;

View File

@ -35,7 +35,6 @@ import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.CommandDeclaration;
import com.intellectualsites.commands.callers.CommandCaller; import com.intellectualsites.commands.callers.CommandCaller;
import com.plotsquared.bukkit.util.UUIDHandler; import com.plotsquared.bukkit.util.UUIDHandler;
import com.plotsquared.bukkit.util.bukkit.UUIDHandler;
@CommandDeclaration( @CommandDeclaration(
command = "delete", command = "delete",

View File

@ -34,8 +34,8 @@ import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.Argument;
import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.CommandDeclaration;
import com.intellectualsites.commands.callers.CommandCaller; 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; import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
@CommandDeclaration( @CommandDeclaration(

View File

@ -24,6 +24,8 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import com.intellectualsites.commands.CommandDeclaration;
import com.intellectualsites.commands.callers.CommandCaller;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import com.intellectualcrafters.plot.config.C; 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.MainUtil;
import com.intellectualcrafters.plot.util.Permissions; 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 class FlagCmd extends SubCommand {
public FlagCmd() {
super(Command.FLAG, "Manage plot flags", "f", CommandCategory.ACTIONS, true);
}
@Override @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 set fly true
* plot flag remove fly * plot flag remove fly

View File

@ -29,6 +29,7 @@ import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.CommandDeclaration;
import com.intellectualsites.commands.callers.CommandCaller; import com.intellectualsites.commands.callers.CommandCaller;
import com.plotsquared.bukkit.util.UUIDHandler;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import com.intellectualcrafters.plot.config.C; 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.MainUtil;
import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.bukkit.util.bukkit.UUIDHandler;
@CommandDeclaration( @CommandDeclaration(
command = "info", command = "info",

View File

@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.CommandDeclaration;
import com.intellectualsites.commands.callers.CommandCaller; import com.intellectualsites.commands.callers.CommandCaller;
import com.plotsquared.bukkit.util.bukkit.UUIDHandler; import com.plotsquared.bukkit.util.UUIDHandler;
@CommandDeclaration( @CommandDeclaration(
command = "kick", command = "kick",

View File

@ -30,11 +30,11 @@ import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.CommandDeclaration;
import com.intellectualsites.commands.callers.CommandCaller; import com.intellectualsites.commands.callers.CommandCaller;
import com.plotsquared.bukkit.util.bukkit.UUIDHandler; import com.plotsquared.bukkit.util.UUIDHandler;
@CommandDeclaration( @CommandDeclaration(
command = "purge", command = "purge",

View File

@ -33,7 +33,8 @@ import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.Argument;
import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.CommandDeclaration;
import com.intellectualsites.commands.callers.CommandCaller; 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; import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
@CommandDeclaration( @CommandDeclaration(

View File

@ -27,6 +27,7 @@ import java.util.HashMap;
import java.util.UUID; import java.util.UUID;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Location; 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;
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic; import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
import com.intellectualcrafters.plot.util.TaskManager; 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 <arg...>"
)
public class SchematicCmd extends SubCommand { public class SchematicCmd extends SubCommand {
private int counter = 0; private int counter = 0;
private boolean running = false; private boolean running = false;
private int task; 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 @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) { if (args.length < 1) {
sendMessage(plr, C.SCHEMATIC_MISSING_ARG); sendMessage(plr, C.SCHEMATIC_MISSING_ARG);
return true; return true;

View File

@ -24,6 +24,9 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; 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 org.apache.commons.lang.StringUtils;
import com.intellectualcrafters.plot.PS; 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.SetBlockQueue;
import com.intellectualcrafters.plot.util.StringComparison; import com.intellectualcrafters.plot.util.StringComparison;
import com.intellectualcrafters.plot.util.StringMan; 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 <arg> <value(s)...>",
permission = "plots.set",
category = CommandCategory.ACTIONS,
requiredType = PlotPlayer.class
)
public class Set extends SubCommand { public class Set extends SubCommand {
public final static String[] values = new String[] { "biome", "alias", "home", "flag" }; 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 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 @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 Location loc = plr.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {

View File

@ -36,7 +36,7 @@ import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.Argument;
import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.CommandDeclaration;
import com.intellectualsites.commands.callers.CommandCaller; import com.intellectualsites.commands.callers.CommandCaller;
import com.plotsquared.bukkit.util.bukkit.UUIDHandler; import com.plotsquared.bukkit.util.UUIDHandler;
@CommandDeclaration( @CommandDeclaration(
command = "setowner", command = "setowner",

View File

@ -23,6 +23,7 @@ package com.intellectualcrafters.plot.commands;
import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.Argument;
import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.CommandDeclaration;
import com.intellectualsites.commands.callers.CommandCaller; import com.intellectualsites.commands.callers.CommandCaller;
import com.plotsquared.bukkit.util.UUIDHandler;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import com.intellectualcrafters.plot.PS; 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.object.PlotPlayer;
import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.plotsquared.bukkit.util.bukkit.UUIDHandler;
@CommandDeclaration( @CommandDeclaration(
command = "tp", command = "tp",

View File

@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.Argument;
import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.CommandDeclaration;
import com.intellectualsites.commands.callers.CommandCaller; 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; import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
@CommandDeclaration( @CommandDeclaration(

View File

@ -32,7 +32,8 @@ import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.Argument;
import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.CommandDeclaration;
import com.intellectualsites.commands.callers.CommandCaller; 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; import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
@CommandDeclaration( @CommandDeclaration(

View File

@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.Argument;
import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.CommandDeclaration;
import com.intellectualsites.commands.callers.CommandCaller; import com.intellectualsites.commands.callers.CommandCaller;
import com.plotsquared.bukkit.util.bukkit.UUIDHandler; import com.plotsquared.bukkit.util.UUIDHandler;
// UNTRUST("untrust", "ut"), // UNTRUST("untrust", "ut"),

View File

@ -33,7 +33,7 @@ import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.Argument;
import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.CommandDeclaration;
import com.intellectualsites.commands.callers.CommandCaller; import com.intellectualsites.commands.callers.CommandCaller;
import com.plotsquared.bukkit.util.bukkit.UUIDHandler; import com.plotsquared.bukkit.util.UUIDHandler;
@CommandDeclaration( @CommandDeclaration(
command = "visit", command = "visit",

View File

@ -32,6 +32,7 @@ import java.util.UUID;
import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller; import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller;
import com.intellectualsites.commands.CommandDeclaration; import com.intellectualsites.commands.CommandDeclaration;
import com.intellectualsites.commands.callers.CommandCaller; import com.intellectualsites.commands.callers.CommandCaller;
import com.plotsquared.bukkit.util.UUIDHandler;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor; 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.MainUtil;
import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.StringComparison; import com.intellectualcrafters.plot.util.StringComparison;
import com.plotsquared.bukkit.util.bukkit.UUIDHandler;
import com.plotsquared.bukkit.util.bukkit.chat.FancyMessage; import com.plotsquared.bukkit.util.bukkit.chat.FancyMessage;
@CommandDeclaration( @CommandDeclaration(