From fb729df59e40e54d4fc9bab99f7c1b9125682f0c Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 23 Nov 2016 15:35:17 +1100 Subject: [PATCH] Setting to sort plots by area --- .../com/intellectualcrafters/plot/commands/Visit.java | 10 ++++++++-- .../com/intellectualcrafters/plot/config/Settings.java | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Visit.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Visit.java index b1fddd228..d7132df25 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Visit.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Visit.java @@ -2,6 +2,7 @@ package com.intellectualcrafters.plot.commands; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; +import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.RunnableVal2; @@ -49,7 +50,7 @@ public class Visit extends Command { case 2: if (!MathMan.isInteger(args[1])) { C.NOT_VALID_NUMBER.send(player, "(1, ∞)"); - C.COMMAND_SYNTAX.send(player, getUsage());; + C.COMMAND_SYNTAX.send(player, getUsage()); return; } page = Integer.parseInt(args[1]); @@ -93,7 +94,12 @@ public class Visit extends Command { C.NOT_VALID_NUMBER.send(player, "(1, " + unsorted.size() + ")"); return; } - List plots = PS.get().sortPlotsByTemp(unsorted); + List 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); if (!plot.hasOwner()) { if (!Permissions.hasPermission(player, C.PERMISSION_VISIT_UNOWNED)) { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java b/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java index 58870f3bb..07a4f4001 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/config/Settings.java @@ -249,6 +249,8 @@ public class Settings extends Config { public static boolean ON_LOGIN = false; @Comment("Add a teleportation delay to all commands") 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 {