diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java index 9c9326ba7..3bcb1324a 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java @@ -781,6 +781,9 @@ public class PlotSquared { options.put("max_plots", Settings.MAX_PLOTS); options.put("schematics.save_path", Settings.SCHEMATIC_SAVE_PATH); options.put("uuid.read-from-disk", Settings.UUID_FROM_DISK); + + options.put("cache.permissions", Settings.PERMISSION_CACHING); + options.put("titles", Settings.TITLES); options.put("teleport.on_login", Settings.TELEPORT_ON_LOGIN); options.put("worldedit.require-selection-in-mask", Settings.REQUIRE_SELECTION); @@ -795,6 +798,7 @@ public class PlotSquared { log(C.PREFIX.s() + "&6Debug Mode Enabled (Default). Edit the config to turn this off."); } + Settings.PERMISSION_CACHING = config.getBoolean("cache.permissions"); Settings.CONFIRM_CLEAR = config.getBoolean("confirmation.clear"); Settings.CONFIRM_DELETE = config.getBoolean("confirmation.delete"); Settings.CONFIRM_UNLINK = config.getBoolean("confirmation.unlink"); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java index 051ab5cf0..10f253877 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java @@ -32,6 +32,7 @@ public class Settings { * Default UUID_FECTHING: false */ public static boolean UUID_FECTHING = false; + public static boolean PERMISSION_CACHING = false; public static boolean UUID_FROM_DISK = false; /** * diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/BukkitPlayer.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/BukkitPlayer.java index 2c2d86bd2..dc7c85592 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/BukkitPlayer.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/BukkitPlayer.java @@ -5,6 +5,7 @@ import java.util.UUID; import org.bukkit.entity.Player; +import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; @@ -40,19 +41,22 @@ public class BukkitPlayer implements PlotPlayer { @Override public boolean hasPermission(final String perm) { - if (this.noPerm.contains(perm)) { - return false; - } - if (this.hasPerm.contains(perm)) { + if (Settings.PERMISSION_CACHING) { + if (this.noPerm.contains(perm)) { + return false; + } + if (this.hasPerm.contains(perm)) { + return true; + } + final boolean result = this.player.hasPermission(perm); + if (!result) { + this.noPerm.add(perm); + return false; + } + this.hasPerm.add(perm); return true; } - final boolean result = this.player.hasPermission(perm); - if (!result) { - this.noPerm.add(perm); - return false; - } - this.hasPerm.add(perm); - return true; + return this.player.hasPermission(perm); } @Override