mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-17 12:54:43 +02:00
Sorting / Tweaks / Fixes
Fixes #499 Add sortPlotsByTimestamp method to PS tweak to debugexec
This commit is contained in:
@ -92,7 +92,10 @@ public class DebugExec extends SubCommand {
|
||||
if (engine != null) {
|
||||
return;
|
||||
}
|
||||
engine = (new ScriptEngineManager()).getEngineByName("JavaScript");
|
||||
engine = (new ScriptEngineManager()).getEngineByName("nashorn");
|
||||
if (engine == null) {
|
||||
engine = (new ScriptEngineManager()).getEngineByName("JavaScript");
|
||||
}
|
||||
ScriptContext context = new SimpleScriptContext();
|
||||
scope = context.getBindings(ScriptContext.ENGINE_SCOPE);
|
||||
|
||||
@ -128,21 +131,14 @@ public class DebugExec extends SubCommand {
|
||||
scope.put("MainCommand", MainCommand.getInstance());
|
||||
|
||||
// enums
|
||||
for (Enum value : C.values()) {
|
||||
for (Enum<?> value : C.values()) {
|
||||
scope.put("C_" + value.name(), value);
|
||||
}
|
||||
for (Enum value : Permissions.values()) {
|
||||
for (Enum<?> value : Permissions.values()) {
|
||||
scope.put("Permissions_" + value.name(), value);
|
||||
}
|
||||
addEnums(scope, C.values());
|
||||
}
|
||||
|
||||
|
||||
private void addEnums(Bindings scope2, C[] values) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
final List<String> allowed_params = Arrays.asList("calibrate-analysis", "remove-flag", "stop-expire", "start-expire", "show-expired", "update-expired", "seen", "trim-check");
|
||||
|
@ -40,7 +40,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
|
||||
permission = "plots.delete",
|
||||
description = "Delete a plot",
|
||||
usage = "/plot delete",
|
||||
aliases = "dispose",
|
||||
aliases = {"dispose", "del"},
|
||||
category = CommandCategory.ACTIONS,
|
||||
requiredType = RequiredType.NONE
|
||||
)
|
||||
|
@ -62,7 +62,7 @@ public class SetOwner extends SubCommand {
|
||||
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||
final Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if ((plot == null) || (plot.owner == null)) {
|
||||
if ((plot == null) || (plot.owner == null && !Permissions.hasPermission(plr, "plots.admin.command.setowner"))) {
|
||||
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
|
||||
return false;
|
||||
}
|
||||
@ -107,10 +107,17 @@ public class SetOwner extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
for (final PlotId id : plots) {
|
||||
final Plot current = PS.get().getPlots(world).get(id);
|
||||
current.owner = uuid;
|
||||
Plot current = PS.get().getPlots(world).get(id);
|
||||
if (current == null) {
|
||||
current = MainUtil.getPlot(world, id);
|
||||
current.owner = uuid;
|
||||
current.create();
|
||||
}
|
||||
else {
|
||||
current.owner = uuid;
|
||||
DBFunc.setOwner(current, current.owner);
|
||||
}
|
||||
PS.get().updatePlot(current);
|
||||
DBFunc.setOwner(current, current.owner);
|
||||
}
|
||||
MainUtil.setSign(args[0], plot);
|
||||
MainUtil.sendMessage(plr, C.SET_OWNER);
|
||||
|
@ -67,10 +67,10 @@ public class Visit extends SubCommand {
|
||||
UUID user = UUIDHandler.getCachedUUID(args[0], null);
|
||||
if (user != null ) {
|
||||
// do plots by username
|
||||
plots.addAll(PS.get().getPlots(user));
|
||||
plots = PS.get().sortPlots(PS.get().getPlots(user), null);
|
||||
} else if (PS.get().isPlotWorld(args[0])) {
|
||||
// do plots by world
|
||||
plots.addAll(PS.get().getPlots(args[0]).values());
|
||||
plots = PS.get().sortPlots(PS.get().getPlots(args[0]).values(), null);
|
||||
}
|
||||
else {
|
||||
Plot plot = MainUtil.getPlotFromString(plr, args[0], true);
|
||||
|
@ -303,12 +303,7 @@ public class list extends SubCommand {
|
||||
|
||||
public void displayPlots(PlotPlayer player, List<Plot> plots, int pageSize, int page, String world, String[] args, boolean sort) {
|
||||
if (sort) {
|
||||
if (world != null) {
|
||||
plots = PS.get().sortPlots(plots, world);
|
||||
}
|
||||
else {
|
||||
plots = PS.get().sortPlots(plots);
|
||||
}
|
||||
plots = PS.get().sortPlots(plots, world);
|
||||
}
|
||||
if (page < 0) {
|
||||
page = 0;
|
||||
|
Reference in New Issue
Block a user