Fixed bug where Ops could not see admin help by default.

This commit is contained in:
tastybento 2018-07-18 21:28:15 -07:00
parent 9920e31abb
commit 0b77225f06
2 changed files with 3 additions and 3 deletions

View File

@ -483,7 +483,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
for (CompositeCommand subCommand: cmd.getSubCommands().values()) { for (CompositeCommand subCommand: cmd.getSubCommands().values()) {
if (sender instanceof Player) { if (sender instanceof Player) {
// Player // Player
if (subCommand.getPermission().isEmpty() || sender.hasPermission(subCommand.getPermission())) { if (subCommand.getPermission().isEmpty() || sender.hasPermission(subCommand.getPermission()) || sender.isOp()) {
// Permission is okay // Permission is okay
options.add(subCommand.getLabel()); options.add(subCommand.getLabel());
} }

View File

@ -84,14 +84,14 @@ public class DefaultHelpCommand extends CompositeCommand {
Optional<CompositeCommand> sub = subCommand.getSubCommand(HELP); Optional<CompositeCommand> sub = subCommand.getSubCommand(HELP);
sub.ifPresent(compositeCommand -> compositeCommand.execute(user, HELP, Collections.singletonList(String.valueOf(newDepth)))); sub.ifPresent(compositeCommand -> compositeCommand.execute(user, HELP, Collections.singletonList(String.valueOf(newDepth))));
} }
} }
} }
private boolean showPrettyHelp(User user, String usage, String params, String desc) { private boolean showPrettyHelp(User user, String usage, String params, String desc) {
// Show the help // Show the help
if (user.isPlayer()) { if (user.isPlayer()) {
// Player. Check perms // Player. Check perms
if (user.hasPermission(parent.getPermission())) { if (user.isOp() || user.hasPermission(parent.getPermission())) {
user.sendMessage(HELP_SYNTAX_REF, USAGE_PLACEHOLDER, usage, PARAMS_PLACEHOLDER, params, DESC_PLACEHOLDER, desc); user.sendMessage(HELP_SYNTAX_REF, USAGE_PLACEHOLDER, usage, PARAMS_PLACEHOLDER, params, DESC_PLACEHOLDER, desc);
} else { } else {
// No permission, nothing to see here. If you don't have permission, you cannot see any sub commands // No permission, nothing to see here. If you don't have permission, you cannot see any sub commands