mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Fixes #1015
This commit is contained in:
parent
5f8a55568c
commit
eed8cbec5a
@ -397,9 +397,8 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
if (econ.init()) {
|
if (econ.init()) {
|
||||||
return econ;
|
return econ;
|
||||||
}
|
}
|
||||||
System.out.println("ECONOMY ENABLED!");
|
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
ignored.printStackTrace();
|
PS.debug("No economy detected!");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -263,7 +263,6 @@ public class PS {
|
|||||||
TaskManager.runTask(new Runnable() {
|
TaskManager.runTask(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
System.out.println("SETTING UP ECON");
|
|
||||||
EconHandler.manager = PS.this.IMP.getEconomyHandler();
|
EconHandler.manager = PS.this.IMP.getEconomyHandler();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -49,10 +49,6 @@ public class Add extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(PlotPlayer plr, String[] args) {
|
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();
|
Location loc = plr.getLocation();
|
||||||
Plot plot = loc.getPlotAbs();
|
Plot plot = loc.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
|
@ -49,10 +49,6 @@ public class Remove extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(PlotPlayer plr, String[] args) {
|
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();
|
Location loc = plr.getLocation();
|
||||||
Plot plot = loc.getPlotAbs();
|
Plot plot = loc.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
|
@ -48,10 +48,6 @@ public class Trust extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(PlotPlayer plr, String[] args) {
|
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();
|
Location loc = plr.getLocation();
|
||||||
Plot plot = loc.getPlotAbs();
|
Plot plot = loc.getPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
|
@ -14,7 +14,6 @@ import com.intellectualcrafters.plot.util.MathMan;
|
|||||||
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.intellectualcrafters.plot.util.StringMan;
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
@ -323,7 +322,15 @@ public abstract class Command {
|
|||||||
}
|
}
|
||||||
return;
|
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)) {
|
if ((reqArgs != null) && (reqArgs.length > 0)) {
|
||||||
boolean failed = args.length < reqArgs.length;
|
boolean failed = args.length < reqArgs.length;
|
||||||
String[] baseSplit = getCommandString().split(" ");
|
String[] baseSplit = getCommandString().split(" ");
|
||||||
@ -335,13 +342,10 @@ public abstract class Command {
|
|||||||
}
|
}
|
||||||
if (failed) {
|
if (failed) {
|
||||||
C.COMMAND_SYNTAX.send(player, StringMan.join(fullSplit, " "));
|
C.COMMAND_SYNTAX.send(player, StringMan.join(fullSplit, " "));
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!cmd.canExecute(player, true)) {
|
return true;
|
||||||
return;
|
|
||||||
}
|
|
||||||
cmd.execute(player, Arrays.copyOfRange(args, 1, args.length), confirm, whenDone);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMatch(String[] args, Command cmd) {
|
public int getMatch(String[] args, Command cmd) {
|
||||||
|
Loading…
Reference in New Issue
Block a user