File tree Expand file tree Collapse file tree
common/src/main/java/com/lishid/openinv/util
java/com/lishid/openinv/listener Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,7 +49,9 @@ public enum Permissions {
4949 SPECTATE_CLICK ("spectate.click" ),
5050
5151 CONTAINER_ANY ("container.any" ),
52+ CONTAINER_ANY_USE ("container.any.use" ),
5253 CONTAINER_SILENT ("container.silent" ),
54+ CONTAINER_SILENT_USE ("container.silent.use" ),
5355 SEARCH_INVENTORY ("search.inventory" ),
5456 SEARCH_CONTAINER ("search.container" );
5557
@@ -63,4 +65,9 @@ public boolean hasPermission(@NotNull Permissible permissible) {
6365 return permissible .hasPermission (permission );
6466 }
6567
68+ public boolean hasPermission (@ NotNull Permissible permissible , @ NotNull Permissions parent ) {
69+ if (permissible .hasPermission (permission )) return true ;
70+ if (permissible .isPermissionSet (permission ) && !permissible .hasPermission (permission )) return false ;
71+ return permissible .hasPermission (parent .permission );
72+ }
6673}
Original file line number Diff line number Diff line change @@ -72,14 +72,14 @@ private void onPlayerInteract(@NotNull PlayerInteractEvent event) {
7272
7373 Player player = event .getPlayer ();
7474 UUID playerId = player .getUniqueId ();
75- boolean any = Permissions .CONTAINER_ANY .hasPermission (player ) && PlayerToggles .any ().is (playerId );
75+ boolean any = Permissions .CONTAINER_ANY_USE .hasPermission (player , Permissions . CONTAINER_ANY ) && PlayerToggles .any ().is (playerId );
7676 boolean needsAny = accessor .getAnySilentContainer ().isAnyContainerNeeded (event .getClickedBlock ());
7777
7878 if (!any && needsAny ) {
7979 return ;
8080 }
8181
82- boolean silent = Permissions .CONTAINER_SILENT .hasPermission (player ) && PlayerToggles .silent ().is (playerId );
82+ boolean silent = Permissions .CONTAINER_SILENT_USE .hasPermission (player , Permissions . CONTAINER_SILENT ) && PlayerToggles .silent ().is (playerId );
8383
8484 // If anycontainer or silentcontainer is active
8585 if (any || silent ) {
Original file line number Diff line number Diff line change @@ -76,8 +76,16 @@ permissions:
7676 # Container features
7777 openinv.container :
7878 children :
79- openinv.container.any : true
80- openinv.container.silent : true
79+ openinv.container.any :
80+ children :
81+ openinv.container.any.use : true
82+ openinv.container.any.use :
83+ default : false
84+ openinv.container.silent :
85+ children :
86+ openinv.container.silent.use : true
87+ openinv.container.silent.use :
88+ default : false
8189 # Search functionality
8290 openinv.search :
8391 children :
You can’t perform that action at this time.
0 commit comments