mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 19:55:17 +01:00
Fixes help permissions.
This commit is contained in:
parent
d94477034a
commit
320c9a9f43
@ -439,6 +439,13 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
||||
public void setPermission(String permission) {
|
||||
this.permission = permissionPrefix + permission;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherits the permission from parent command
|
||||
*/
|
||||
public void inheritPermission() {
|
||||
this.permission = parent.getPermission();
|
||||
}
|
||||
|
||||
/**
|
||||
* This creates the full linking chain of commands
|
||||
|
@ -32,7 +32,7 @@ public class DefaultHelpCommand extends CompositeCommand {
|
||||
// Set the usage to what the parent's command is
|
||||
setParameters(parent.getParameters());
|
||||
setDescription(parent.getDescription());
|
||||
setPermission(parent.getPermission());
|
||||
inheritPermission();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,7 @@ public class CustomIslandMultiHomeHelp extends CompositeCommand {
|
||||
// Inherit parameters from the respective parent class - in this case, only /island go and /island sethome
|
||||
setParameters(parent.getParameters());
|
||||
setDescription(parent.getDescription());
|
||||
setPermission(parent.getPermission());
|
||||
inheritPermission();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -127,6 +127,7 @@ public class DefaultHelpCommandTest {
|
||||
CompositeCommand cc = mock(CompositeCommand.class);
|
||||
DefaultHelpCommand dhc = new DefaultHelpCommand(cc);
|
||||
assertNotNull(dhc);
|
||||
// Verify that parent's parameters and permission is used
|
||||
Mockito.verify(cc).getParameters();
|
||||
Mockito.verify(cc).getDescription();
|
||||
Mockito.verify(cc).getPermission();
|
||||
|
Loading…
Reference in New Issue
Block a user