Setting to sort plots by area

This commit is contained in:
Jesse Boyd 2016-11-23 15:35:17 +11:00
parent ce6e1be13e
commit fb729df59e
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 10 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package com.intellectualcrafters.plot.commands;
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.config.Settings;
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.object.RunnableVal2; import com.intellectualcrafters.plot.object.RunnableVal2;
@ -49,7 +50,7 @@ public class Visit extends Command {
case 2: case 2:
if (!MathMan.isInteger(args[1])) { if (!MathMan.isInteger(args[1])) {
C.NOT_VALID_NUMBER.send(player, "(1, ∞)"); C.NOT_VALID_NUMBER.send(player, "(1, ∞)");
C.COMMAND_SYNTAX.send(player, getUsage());; C.COMMAND_SYNTAX.send(player, getUsage());
return; return;
} }
page = Integer.parseInt(args[1]); page = Integer.parseInt(args[1]);
@ -93,7 +94,12 @@ public class Visit extends Command {
C.NOT_VALID_NUMBER.send(player, "(1, " + unsorted.size() + ")"); C.NOT_VALID_NUMBER.send(player, "(1, " + unsorted.size() + ")");
return; return;
} }
List<Plot> plots = PS.get().sortPlotsByTemp(unsorted); List<Plot> plots;
if (Settings.Teleport.PER_WORLD_VISIT) {
plots = PS.get().sortPlots(unsorted, PS.SortType.CREATION_DATE, player.getApplicablePlotArea());
} else {
plots = PS.get().sortPlotsByTemp(unsorted);
}
final Plot plot = plots.get(page - 1); final Plot plot = plots.get(page - 1);
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (!Permissions.hasPermission(player, C.PERMISSION_VISIT_UNOWNED)) { if (!Permissions.hasPermission(player, C.PERMISSION_VISIT_UNOWNED)) {

View File

@ -249,6 +249,8 @@ public class Settings extends Config {
public static boolean ON_LOGIN = false; public static boolean ON_LOGIN = false;
@Comment("Add a teleportation delay to all commands") @Comment("Add a teleportation delay to all commands")
public static int DELAY = 0; public static int DELAY = 0;
@Comment("The visit command is ordered by world instead of globally")
public static boolean PER_WORLD_VISIT = false;
} }
public static final class Redstone { public static final class Redstone {