@@ -112,7 +112,7 @@ public abstract class CommandManager<C> implements Stateful<RegistrationState>,
112112 private final Set <CloudCapability > capabilities = new HashSet <>();
113113 private final ExceptionController <C > exceptionController = new ExceptionController <>();
114114 private final CommandExecutor <C > commandExecutor ;
115- final ThreadLocalPermissionCache <C > threadLocalPermissionCache = new ThreadLocalPermissionCache <>(this .settings );
115+ private final ThreadLocalPermissionCache <C > threadLocalPermissionCache = new ThreadLocalPermissionCache <>(this .settings );
116116
117117 private CaptionFormatter <C , String > captionVariableReplacementHandler = CaptionFormatter .placeholderReplacing ();
118118 private CommandSyntaxFormatter <C > commandSyntaxFormatter = new StandardCommandSyntaxFormatter <>(this );
@@ -178,6 +178,10 @@ protected CommandManager(
178178 return this .commandExecutor ;
179179 }
180180
181+ final @ NonNull ThreadLocalPermissionCache <C > threadLocalPermissionCache () {
182+ return this .threadLocalPermissionCache ;
183+ }
184+
181185 /**
182186 * Returns the suggestion factory.
183187 *
@@ -392,26 +396,26 @@ public boolean hasCapability(final @NonNull CloudCapability capability) {
392396 final @ NonNull C sender ,
393397 final @ NonNull Permission permission
394398 ) {
395- return this .threadLocalPermissionCache .withPermissionCache (() -> this .testPermission_ (sender , permission ));
399+ return this .threadLocalPermissionCache .withPermissionCache (() -> this .testPermissionRaw (sender , permission ));
396400 }
397401
398402 @ SuppressWarnings ("unchecked" )
399- private @ NonNull PermissionResult testPermission_ (final @ NonNull C sender , final @ NonNull Permission permission ) {
403+ private @ NonNull PermissionResult testPermissionRaw (final @ NonNull C sender , final @ NonNull Permission permission ) {
400404 if (permission instanceof PredicatePermission ) {
401405 return this .threadLocalPermissionCache .testPermissionCaching (sender , (PredicatePermission <C >) permission , pair -> {
402406 return pair .second ().testPermission (pair .first ());
403407 });
404408 } else if (permission instanceof OrPermission ) {
405409 for (final Permission innerPermission : permission .permissions ()) {
406- final PermissionResult result = this .testPermission_ (sender , innerPermission );
410+ final PermissionResult result = this .testPermissionRaw (sender , innerPermission );
407411 if (result .allowed ()) {
408412 return result ;
409413 }
410414 }
411415 return PermissionResult .denied (permission );
412416 } else if (permission instanceof AndPermission ) {
413417 for (final Permission innerPermission : permission .permissions ()) {
414- final PermissionResult result = this .testPermission_ (sender , innerPermission );
418+ final PermissionResult result = this .testPermissionRaw (sender , innerPermission );
415419 if (!result .allowed ()) {
416420 return result ;
417421 }
0 commit comments