From 0b77225f06b075df4b44ccfbc4dc6b1a5022464c Mon Sep 17 00:00:00 2001 From: tastybento Date: Wed, 18 Jul 2018 21:28:15 -0700 Subject: [PATCH] Fixed bug where Ops could not see admin help by default. --- .../tastybento/bskyblock/api/commands/CompositeCommand.java | 2 +- .../tastybento/bskyblock/api/commands/DefaultHelpCommand.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/us/tastybento/bskyblock/api/commands/CompositeCommand.java b/src/main/java/us/tastybento/bskyblock/api/commands/CompositeCommand.java index bd7c92028..ccda8f9e0 100644 --- a/src/main/java/us/tastybento/bskyblock/api/commands/CompositeCommand.java +++ b/src/main/java/us/tastybento/bskyblock/api/commands/CompositeCommand.java @@ -483,7 +483,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi for (CompositeCommand subCommand: cmd.getSubCommands().values()) { if (sender instanceof Player) { // Player - if (subCommand.getPermission().isEmpty() || sender.hasPermission(subCommand.getPermission())) { + if (subCommand.getPermission().isEmpty() || sender.hasPermission(subCommand.getPermission()) || sender.isOp()) { // Permission is okay options.add(subCommand.getLabel()); } diff --git a/src/main/java/us/tastybento/bskyblock/api/commands/DefaultHelpCommand.java b/src/main/java/us/tastybento/bskyblock/api/commands/DefaultHelpCommand.java index 5de58f9c5..7167f5a1a 100644 --- a/src/main/java/us/tastybento/bskyblock/api/commands/DefaultHelpCommand.java +++ b/src/main/java/us/tastybento/bskyblock/api/commands/DefaultHelpCommand.java @@ -84,14 +84,14 @@ public class DefaultHelpCommand extends CompositeCommand { Optional sub = subCommand.getSubCommand(HELP); sub.ifPresent(compositeCommand -> compositeCommand.execute(user, HELP, Collections.singletonList(String.valueOf(newDepth)))); } - } + } } private boolean showPrettyHelp(User user, String usage, String params, String desc) { // Show the help if (user.isPlayer()) { // 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); } else { // No permission, nothing to see here. If you don't have permission, you cannot see any sub commands