This commit is contained in:
Jesse Boyd 2016-03-29 17:39:29 +11:00
parent 5f8a55568c
commit eed8cbec5a
6 changed files with 12 additions and 22 deletions

View file

@ -397,9 +397,8 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
if (econ.init()) {
return econ;
}
System.out.println("ECONOMY ENABLED!");
} catch (Throwable ignored) {
ignored.printStackTrace();
PS.debug("No economy detected!");
}
return null;
}

View file

@ -263,7 +263,6 @@ public class PS {
TaskManager.runTask(new Runnable() {
@Override
public void run() {
System.out.println("SETTING UP ECON");
EconHandler.manager = PS.this.IMP.getEconomyHandler();
}
});

View file

@ -49,10 +49,6 @@ public class Add extends SubCommand {
@Override
public boolean onCommand(PlotPlayer plr, String[] args) {
if (args.length != 1) {
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, this.getUsage());
return true;
}
Location loc = plr.getLocation();
Plot plot = loc.getPlotAbs();
if (plot == null) {

View file

@ -49,10 +49,6 @@ public class Remove extends SubCommand {
@Override
public boolean onCommand(PlotPlayer plr, String[] args) {
if (args.length != 1) {
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, this.getUsage());
return true;
}
Location loc = plr.getLocation();
Plot plot = loc.getPlotAbs();
if (plot == null) {

View file

@ -48,10 +48,6 @@ public class Trust extends SubCommand {
@Override
public boolean onCommand(PlotPlayer plr, String[] args) {
if (args.length != 1) {
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, this.getUsage());
return true;
}
Location loc = plr.getLocation();
Plot plot = loc.getPlotAbs();
if (plot == null) {

View file

@ -14,7 +14,6 @@ import com.intellectualcrafters.plot.util.MathMan;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.StringComparison;
import com.intellectualcrafters.plot.util.StringMan;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
@ -323,7 +322,15 @@ public abstract class Command {
}
return;
}
Argument<?>[] reqArgs = cmd.getRequiredArguments();
String[] newArgs = Arrays.copyOfRange(args, 1, args.length);
if (!cmd.checkArgs(player, newArgs) || !cmd.canExecute(player, true)) {
return;
}
cmd.execute(player, newArgs, confirm, whenDone);
}
public boolean checkArgs(PlotPlayer player, String[] args) {
Argument<?>[] reqArgs = getRequiredArguments();
if ((reqArgs != null) && (reqArgs.length > 0)) {
boolean failed = args.length < reqArgs.length;
String[] baseSplit = getCommandString().split(" ");
@ -335,13 +342,10 @@ public abstract class Command {
}
if (failed) {
C.COMMAND_SYNTAX.send(player, StringMan.join(fullSplit, " "));
return;
return false;
}
}
if (!cmd.canExecute(player, true)) {
return;
}
cmd.execute(player, Arrays.copyOfRange(args, 1, args.length), confirm, whenDone);
return true;
}
public int getMatch(String[] args, Command cmd) {