From 30a2c5d8816d0af6d9cd254b67c21f0aead33744 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 13 Apr 2016 03:35:14 +1000 Subject: [PATCH] perm requirement for add/trust * --- .../java/com/intellectualcrafters/plot/commands/Add.java | 2 +- .../com/intellectualcrafters/plot/commands/ListCmd.java | 7 ++++++- .../java/com/intellectualcrafters/plot/commands/Trust.java | 2 +- .../com/intellectualcrafters/plot/util/ExpireManager.java | 3 ++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java index baba1435f..1ccd4d41a 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java @@ -43,7 +43,7 @@ public class Add extends SubCommand { return true; } UUID uuid; - if (args[0].equalsIgnoreCase("*")) { + if (args[0].equalsIgnoreCase("*") && (Permissions.hasPermission(plr, "plots.add.everyone") || Permissions.hasPermission(plr, "plots.admin.command.add"))) { uuid = DBFunc.everyone; } else { // TODO have a runnable for fetch diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/ListCmd.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/ListCmd.java index 441217d27..6d2d307e3 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/ListCmd.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/ListCmd.java @@ -287,7 +287,12 @@ public class ListCmd extends SubCommand { C.COMMAND_SYNTAX.send(plr, "/plot list fuzzy [#]"); return false; } - String term = StringMan.join(Arrays.copyOfRange(args, 1, args.length - 2), " "); + String term; + if (MathMan.isInteger(args[args.length - 1])) { + term = StringMan.join(Arrays.copyOfRange(args, 1, args.length - 1), " "); + } else { + term = StringMan.join(Arrays.copyOfRange(args, 1, args.length), " "); + } plots = MainUtil.getPlotsBySearch(term); sort = false; break; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Trust.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Trust.java index 390ed1151..0ad231267 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Trust.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Trust.java @@ -42,7 +42,7 @@ public class Trust extends SubCommand { return true; } UUID uuid; - if (args[0].equalsIgnoreCase("*")) { + if (args[0].equalsIgnoreCase("*") && (Permissions.hasPermission(plr, "plots.trust.everyone") || Permissions.hasPermission(plr, "plots.admin.command.trust"))) { uuid = DBFunc.everyone; } else { uuid = UUIDHandler.getUUID(args[0], null); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java b/Core/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java index f281defb2..36a2b4bc9 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java @@ -18,6 +18,7 @@ import com.intellectualcrafters.plot.object.RunnableVal2; import java.util.HashSet; import java.util.Iterator; +import java.util.Objects; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; @@ -259,7 +260,7 @@ public class ExpireManager { } public boolean isExpired(Plot plot) { - if (!plot.hasOwner() || DBFunc.everyone.equals(plot.owner) || UUIDHandler.getPlayer(plot.owner) != null || plot.getRunning() > 0) { + if (!plot.hasOwner() || Objects.equals(DBFunc.everyone, plot.owner) || UUIDHandler.getPlayer(plot.owner) != null || plot.getRunning() > 0) { return false; } Flag keep = plot.getFlag("keep");