From d94f8f4bc7a9132e76f5c2ba0dfcabdc7f77bc02 Mon Sep 17 00:00:00 2001 From: rbluer <665978+rbluer@users.noreply.github.com> Date: Sat, 16 Dec 2023 03:12:13 -0500 Subject: [PATCH] AutoFeatures auto permissions: enable the ability to 'disable' the perms. Any op'd player, if perms are enabled, will have these auto features enabled. There is no other way around this, since this is the correct behavior of OP'd players. --- docs/changelog_v3.3.x.md | 8 +++++++- .../autofeatures/AutoFeaturesFileConfig.java | 7 +++++++ .../spigot/autofeatures/AutoManagerFeatures.java | 16 +++++++++++++--- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/docs/changelog_v3.3.x.md b/docs/changelog_v3.3.x.md index 5cea72cbc..1bee5b997 100644 --- a/docs/changelog_v3.3.x.md +++ b/docs/changelog_v3.3.x.md @@ -14,7 +14,13 @@ These change logs represent the work that has been going on within prison. -# 3.3.0-alpha.16 2023-12-10 +# 3.3.0-alpha.16 2023-12-16 + + +* **AutoFeatures auto permissions: enable the ability to 'disable' the perms.** Any op'd player, if perms are enabled, will have these auto features enabled. There is no other way around this, since this is the correct behavior of OP'd players. + + +* **Mine resets: If a mine reset takes longer than 4 minutes, then that is probably a failure and the mine reset did not complete.** Therefore, reset the mine reset mutex and try again. This allows a "crashed" mine reset to auto fix itself if it can. The 4 minute wait time is LONG, but it will prevent a normal reset from being canceled and restarted in the middle of a restart. * **Performance: Changed the defaults for the mine reset settings to help improve the performance on larger servers.** diff --git a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java index b093c7a5a..bc2a9213e 100644 --- a/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java +++ b/prison-core/src/main/java/tech/mcprison/prison/autofeatures/AutoFeaturesFileConfig.java @@ -262,6 +262,13 @@ public enum AutoFeatures { permissionAutoSmelt(permissions, "prison.automanager.smelt"), permissionAutoBlock(permissions, "prison.automanager.block"), + permissionAuto__readme(permissions, "If permmissions are enabled, of which they are by default, " + + "and 'isAutoFeaturesEnabled' is enabled, then all OPs will automatically " + + "enable auto pickup, auto smelt, and auto block because bukkit will always " + + "test 'true' for any permmission when OP'd. There is no way around this, " + + "other than just turning off these perms, which is not advisable because " + + "players should not be playing as OP'd. To disable these perms, then " + + "use a value of 'disable'."), lore(options), diff --git a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/AutoManagerFeatures.java b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/AutoManagerFeatures.java index 79da13c74..4c0413e29 100644 --- a/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/AutoManagerFeatures.java +++ b/prison-spigot/src/main/java/tech/mcprison/prison/spigot/autofeatures/AutoManagerFeatures.java @@ -516,9 +516,19 @@ private int applyAutoEventsDetails( PrisonMinesBlockBreakEvent pmEvent ) { boolean isAutoFeaturesEnabled = isBoolean( AutoFeatures.isAutoFeaturesEnabled ); - boolean permPickup = isAutoFeaturesEnabled && player.isPermissionSet( getMessage( AutoFeatures.permissionAutoPickup )); - boolean permSmelt = isAutoFeaturesEnabled && player.isPermissionSet( getMessage( AutoFeatures.permissionAutoSmelt )); - boolean permBlock = isAutoFeaturesEnabled && player.isPermissionSet( getMessage( AutoFeatures.permissionAutoBlock )); + String permAutoPickup = getMessage( AutoFeatures.permissionAutoPickup ); + String permAutoSmelt = getMessage( AutoFeatures.permissionAutoSmelt ); + String permAutoBlock = getMessage( AutoFeatures.permissionAutoBlock ); + + boolean permPickup = isAutoFeaturesEnabled && + !"disable".equalsIgnoreCase( permAutoPickup ) && + player.isPermissionSet( permAutoPickup ); + boolean permSmelt = isAutoFeaturesEnabled && + !"disable".equalsIgnoreCase( permAutoSmelt ) && + player.isPermissionSet( permAutoSmelt ); + boolean permBlock = isAutoFeaturesEnabled && + !"disable".equalsIgnoreCase( permAutoBlock ) && + player.isPermissionSet( permAutoBlock ); boolean configPickup = isAutoFeaturesEnabled && isBoolean( AutoFeatures.autoPickupEnabled );