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
@ -440,6 +440,13 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
|||||||
this.permission = permissionPrefix + 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
|
* 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
|
// Set the usage to what the parent's command is
|
||||||
setParameters(parent.getParameters());
|
setParameters(parent.getParameters());
|
||||||
setDescription(parent.getDescription());
|
setDescription(parent.getDescription());
|
||||||
setPermission(parent.getPermission());
|
inheritPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
// Inherit parameters from the respective parent class - in this case, only /island go and /island sethome
|
||||||
setParameters(parent.getParameters());
|
setParameters(parent.getParameters());
|
||||||
setDescription(parent.getDescription());
|
setDescription(parent.getDescription());
|
||||||
setPermission(parent.getPermission());
|
inheritPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -127,6 +127,7 @@ public class DefaultHelpCommandTest {
|
|||||||
CompositeCommand cc = mock(CompositeCommand.class);
|
CompositeCommand cc = mock(CompositeCommand.class);
|
||||||
DefaultHelpCommand dhc = new DefaultHelpCommand(cc);
|
DefaultHelpCommand dhc = new DefaultHelpCommand(cc);
|
||||||
assertNotNull(dhc);
|
assertNotNull(dhc);
|
||||||
|
// Verify that parent's parameters and permission is used
|
||||||
Mockito.verify(cc).getParameters();
|
Mockito.verify(cc).getParameters();
|
||||||
Mockito.verify(cc).getDescription();
|
Mockito.verify(cc).getDescription();
|
||||||
Mockito.verify(cc).getPermission();
|
Mockito.verify(cc).getPermission();
|
||||||
|
Loading…
Reference in New Issue
Block a user