diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java index 8762101ba..efeb04e11 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java @@ -15,6 +15,7 @@ import org.bukkit.event.EventException; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; +import java.util.Set; import java.util.UUID; import org.bukkit.permissions.PermissionAttachmentInfo; @@ -122,14 +123,23 @@ public class BukkitPlayer extends PlotPlayer { } int max = 0; String stubPlus = stub + "."; - for (PermissionAttachmentInfo attach : player.getEffectivePermissions()) { - String perm = attach.getPermission(); - if (perm.startsWith(stubPlus)) { - String end = perm.substring(stubPlus.length()); - if (MathMan.isInteger(end)) { - int val = Integer.parseInt(end); - if (val > range) return val; - if (val > max) max = val; + Set effective = player.getEffectivePermissions(); + if (!effective.isEmpty()) { + for (PermissionAttachmentInfo attach : effective) { + String perm = attach.getPermission(); + if (perm.startsWith(stubPlus)) { + String end = perm.substring(stubPlus.length()); + if (MathMan.isInteger(end)) { + int val = Integer.parseInt(end); + if (val > range) return val; + if (val > max) max = val; + } + } + } + } else { + for (int i = range; i > 0; i--) { + if (hasPermission(stub + "." + i)) { + return i; } } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java index c357e71fe..9ea71d0e4 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java @@ -1,7 +1,9 @@ package com.intellectualcrafters.plot.commands; import com.google.common.base.Optional; +import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; +import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.FlagManager; @@ -37,7 +39,8 @@ public class FlagCmd extends SubCommand { try { int numeric = Integer.parseInt(value); perm.substring(0, perm.length() - value.length() - 1); - return player.hasPermissionRange(perm, numeric) >= numeric; + int checkRange = PS.get().getPlatform().equalsIgnoreCase("bukkit") ? numeric : Settings.Limit.MAX_PLOTS; + return player.hasPermissionRange(perm, checkRange) >= numeric; } catch (NumberFormatException ignore) {} }