mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-28 19:54:43 +02:00
@ -218,7 +218,7 @@ public class DebugExec extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
final String flag = args[1];
|
||||
for (final Plot plot : PS.get().getPlots()) {
|
||||
for (final Plot plot : PS.get().getBasePlots()) {
|
||||
if (FlagManager.getPlotFlagRaw(plot, flag) != null) {
|
||||
FlagManager.removePlotFlag(plot, flag);
|
||||
}
|
||||
@ -409,6 +409,49 @@ public class DebugExec extends SubCommand {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "allcmd": {
|
||||
if (args.length < 3) {
|
||||
C.COMMAND_SYNTAX.send(player, "/plot debugexec allcmd <condition> <command>");
|
||||
return false;
|
||||
}
|
||||
long start = System.currentTimeMillis();
|
||||
Command<PlotPlayer> cmd = MainCommand.getInstance().getCommand(args[3]);
|
||||
String[] params = Arrays.copyOfRange(args, 4, args.length);
|
||||
if (args[1].equals("true")) {
|
||||
Location loc = (Location) player.getMeta("location");
|
||||
Plot plot = (Plot) player.getMeta("lastplot");
|
||||
for (Plot current : PS.get().getBasePlots()) {
|
||||
player.setMeta("location", current.getBottomAbs());
|
||||
player.setMeta("lastplot", current);
|
||||
cmd.onCommand(player, params);
|
||||
}
|
||||
if (loc == null) {
|
||||
player.deleteMeta("location");
|
||||
} else {
|
||||
player.setMeta("location", loc);
|
||||
}
|
||||
if (plot == null) {
|
||||
player.deleteMeta("lastplot");
|
||||
} else {
|
||||
player.setMeta("lastplot", plot);
|
||||
}
|
||||
player.sendMessage("&c> " + (System.currentTimeMillis() - start));
|
||||
return true;
|
||||
}
|
||||
init();
|
||||
scope.put("_2", params);
|
||||
scope.put("_3", cmd);
|
||||
script = "_1=PS.getBasePlots().iterator();while(_1.hasNext()){plot=_1.next();if(" + args[1] + "){PlotPlayer.setMeta(\"location\",plot.getBottomAbs());PlotPlayer.setMeta(\"lastplot\",plot);_3.onCommand(PlotPlayer,_2)}}";
|
||||
break;
|
||||
}
|
||||
case "all": {
|
||||
if (args.length < 3) {
|
||||
C.COMMAND_SYNTAX.send(player, "/plot debugexec all <condition> <code>");
|
||||
return false;
|
||||
}
|
||||
script = "_1=PS.getBasePlots().iterator();while(_1.hasNext()){plot=_1.next();if(" + args[1] + "){" + StringMan.join(Arrays.copyOfRange(args, 2, args.length), " ") + "}}";
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
script = StringMan.join(args, " ");
|
||||
}
|
||||
|
@ -210,6 +210,8 @@ public class MainCommand extends CommandManager<PlotPlayer> {
|
||||
////////////////////////
|
||||
int help_index = -1;
|
||||
String category = null;
|
||||
Location loc = null;
|
||||
Plot plot = null;
|
||||
boolean tp = false;
|
||||
switch (args.length) {
|
||||
case 0: {
|
||||
@ -268,15 +270,21 @@ public class MainCommand extends CommandManager<PlotPlayer> {
|
||||
}
|
||||
default: {
|
||||
if (args.length >= 2) {
|
||||
String world = player.getLocation().getWorld();
|
||||
Plot plot = Plot.fromString(world, args[0]);
|
||||
String world = player.getLocation().getWorld();
|
||||
Plot newPlot = Plot.fromString(world, args[0]);
|
||||
if (newPlot == null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!ConsolePlayer.isConsole(player) && (!newPlot.world.equals(world) || newPlot.isDenied(player.getUUID())) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN)) {
|
||||
break;
|
||||
}
|
||||
// Save meta
|
||||
loc = (Location) player.getMeta("location");
|
||||
loc = (Location) player.getMeta("location");
|
||||
plot = (Plot) player.getMeta("lastplot");
|
||||
tp = true;
|
||||
// Set loc
|
||||
player.setMeta("location", newPlot.getBottomAbs());
|
||||
player.setMeta("lastplot", newPlot);
|
||||
// Trim command
|
||||
args = Arrays.copyOfRange(args, 1, args.length);
|
||||
}
|
||||
@ -292,8 +300,18 @@ public class MainCommand extends CommandManager<PlotPlayer> {
|
||||
args[0] = args[0].replaceFirst(":", " ");
|
||||
}
|
||||
String fullCmd = StringMan.join(args, " ");
|
||||
getInstance().handle(player, cmd + " " + fullCmd);
|
||||
if (loc != null) {
|
||||
getInstance().handle(player, cmd + " " + fullCmd);
|
||||
// Restore location
|
||||
if (tp) {
|
||||
if (loc == null) {
|
||||
player.deleteMeta("location");
|
||||
} else {
|
||||
player.setMeta("location", loc);
|
||||
}
|
||||
if (plot == null) {
|
||||
player.deleteMeta("lastplot");
|
||||
} else {
|
||||
player.setMeta("lastplot", plot);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user