From e016cb5c85156b02d3b82379906689d6f5c30063 Mon Sep 17 00:00:00 2001 From: Roman Alexander Date: Wed, 11 Mar 2015 11:08:51 -0400 Subject: [PATCH] Fixed plot permissions never working. --- .../java/com/intellectualcrafters/plot/commands/Auto.java | 2 +- .../main/java/com/intellectualcrafters/plot/commands/Buy.java | 2 +- .../java/com/intellectualcrafters/plot/commands/Claim.java | 2 +- .../java/com/intellectualcrafters/plot/util/MainUtil.java | 4 ++-- .../java/com/intellectualcrafters/plot/util/Permissions.java | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java index 31cecb185..ef40badde 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java @@ -120,7 +120,7 @@ public class Auto extends SubCommand { return false; } final int currentPlots = MainUtil.getPlayerPlotCount(world, plr); - final int diff = currentPlots - MainUtil.getAllowedPlots(plr, currentPlots); + final int diff = currentPlots - MainUtil.getAllowedPlots(plr); if ((diff + (size_x * size_z)) > 0) { if (diff < 0) { MainUtil.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, (-diff) + ""); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java index 624ff89cf..256a152bf 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java @@ -68,7 +68,7 @@ public class Buy extends SubCommand { return sendMessage(plr, C.NOT_IN_PLOT); } final int currentPlots = MainUtil.getPlayerPlotCount(world, plr); - if (currentPlots >= MainUtil.getAllowedPlots(plr, currentPlots)) { + if (currentPlots >= MainUtil.getAllowedPlots(plr)) { return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS); } if (!plot.hasOwner()) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java index afa6813fd..d4210dd80 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java @@ -91,7 +91,7 @@ public class Claim extends SubCommand { return sendMessage(plr, C.NOT_IN_PLOT); } final int currentPlots = MainUtil.getPlayerPlotCount(loc.getWorld(), plr); - if (currentPlots >= MainUtil.getAllowedPlots(plr, currentPlots)) { + if (currentPlots >= MainUtil.getAllowedPlots(plr)) { return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS); } if (plot.hasOwner()) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index 0292e96b7..97389b968 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -1101,8 +1101,8 @@ public class MainUtil { * @param p * @return */ - public static int getAllowedPlots(final PlotPlayer p, final int current) { - return Permissions.hasPermissionRange(p, "plots.plot", Settings.MAX_PLOTS, current); + public static int getAllowedPlots(final PlotPlayer p) { + return Permissions.hasPermissionRange(p, "plots.plot", Settings.MAX_PLOTS); } public static Plot getPlot(final Location loc) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/Permissions.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/Permissions.java index 28f5594e2..491888487 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/Permissions.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/Permissions.java @@ -36,14 +36,14 @@ public class Permissions { return false; } - public static int hasPermissionRange(final PlotPlayer player, final String stub, final int range, final int min) { + public static int hasPermissionRange(final PlotPlayer player, final String stub, final int range) { if ((player == null) || player.isOp() || player.hasPermission(ADMIN)) { return Byte.MAX_VALUE; } if (player.hasPermission(stub + ".*")) { return Byte.MAX_VALUE; } - for (int i = min; i < range; i++) { + for (int i = range; i > 0; i--) { if (player.hasPermission(stub + "." + i)) { return i; }