mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
Optional permission caching
This commit is contained in:
parent
a1d476321f
commit
27f6675d8f
@ -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");
|
||||
|
@ -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;
|
||||
/**
|
||||
*
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user