mirror of
https://github.com/rockyhawk64/CommandPanels.git
synced 2025-11-18 07:14:17 +01:00
permission observer ability to disable added
This commit is contained in:
parent
cd127d229b
commit
855334ce0a
@ -1,6 +1,6 @@
|
|||||||
# |------------------------------------------------------------------------
|
# |------------------------------------------------------------------------
|
||||||
# | CommandPanels Config File
|
# | CommandPanels Config File
|
||||||
# | By RockyHawk v7
|
# | By RockyHawk v8
|
||||||
# | https://www.spigotmc.org/resources/67788/
|
# | https://www.spigotmc.org/resources/67788/
|
||||||
# |
|
# |
|
||||||
# |------------------------------------------------------------------------
|
# |------------------------------------------------------------------------
|
||||||
@ -11,5 +11,9 @@ custom-commands: true
|
|||||||
# Amount of time in ticks players must wait between opening panels
|
# Amount of time in ticks players must wait between opening panels
|
||||||
cooldown-ticks: 5
|
cooldown-ticks: 5
|
||||||
|
|
||||||
# Will make console logs when panels are opened
|
# Logs to console whenever a panel is opened
|
||||||
panel-snooper: false
|
panel-snooper: false
|
||||||
|
|
||||||
|
# When enabled, panels will automatically refresh if any observed permissions change.
|
||||||
|
# Permissions used in HASPERM conditions are considered observed permissions.
|
||||||
|
permission-observer: true
|
||||||
@ -101,6 +101,8 @@ public class InventoryPanelUpdater {
|
|||||||
updateDelay
|
updateDelay
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final boolean isUsingPermObserver = ctx.fileHandler.config.getBoolean("permission-observer");
|
||||||
|
|
||||||
// Fast heartbeat check task, should run frequently
|
// Fast heartbeat check task, should run frequently
|
||||||
this.checkTask = Bukkit.getRegionScheduler().runAtFixedRate(
|
this.checkTask = Bukkit.getRegionScheduler().runAtFixedRate(
|
||||||
ctx.plugin,
|
ctx.plugin,
|
||||||
@ -114,7 +116,8 @@ public class InventoryPanelUpdater {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do a refresh if an observed perms state changes
|
// Permission Observer: Refresh if an observed perms state changes
|
||||||
|
if(!isUsingPermObserver) return; // Skip if disabled
|
||||||
for (String node : panel.getObservedPerms()) {
|
for (String node : panel.getObservedPerms()) {
|
||||||
boolean currentState = p.hasPermission(node);
|
boolean currentState = p.hasPermission(node);
|
||||||
Boolean previousState = lastObservedPermStates.get(node);
|
Boolean previousState = lastObservedPermStates.get(node);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user