Skip to content

Commit

Permalink
AutoFeatures auto permissions: enable the ability to 'disable' the pe…
Browse files Browse the repository at this point in the history
…rms. 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.
  • Loading branch information
rbluer committed Dec 16, 2023
1 parent dd64e71 commit d94f8f4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
8 changes: 7 additions & 1 deletion docs/changelog_v3.3.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit d94f8f4

Please sign in to comment.