From 42867fe194d1784bc2419694e9b2ab2ef8efb70c Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 15 Mar 2019 19:18:47 -0400 Subject: [PATCH] compute BaseCommand permissions before RegisteredCommands Need to be computed for inheritance --- core/src/main/java/co/aikar/commands/BaseCommand.java | 2 +- .../src/main/java/co/aikar/acfexample/SomeOtherCommand.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/co/aikar/commands/BaseCommand.java b/core/src/main/java/co/aikar/commands/BaseCommand.java index 788a7631..f8d5f981 100644 --- a/core/src/main/java/co/aikar/commands/BaseCommand.java +++ b/core/src/main/java/co/aikar/commands/BaseCommand.java @@ -252,8 +252,8 @@ public abstract class BaseCommand { this.parentSubcommand = getParentSubcommand(self); this.conditions = annotations.getAnnotationValue(self, Conditions.class, Annotations.REPLACEMENTS | Annotations.NO_EMPTY); + computePermissions(); // Must be before any subcommands so they can inherit permissions registerSubcommands(); - computePermissions(); registerSubclasses(cmd); if (cmdAliases != null) { diff --git a/example/src/main/java/co/aikar/acfexample/SomeOtherCommand.java b/example/src/main/java/co/aikar/acfexample/SomeOtherCommand.java index 86f386a6..211df5d8 100644 --- a/example/src/main/java/co/aikar/acfexample/SomeOtherCommand.java +++ b/example/src/main/java/co/aikar/acfexample/SomeOtherCommand.java @@ -4,6 +4,7 @@ import co.aikar.commands.BaseCommand; import co.aikar.commands.CommandHelp; import co.aikar.commands.annotation.CatchUnknown; import co.aikar.commands.annotation.CommandAlias; +import co.aikar.commands.annotation.CommandPermission; import co.aikar.commands.annotation.Default; import co.aikar.commands.annotation.HelpCommand; import co.aikar.commands.annotation.Single; @@ -12,9 +13,11 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @CommandAlias("soctest") +@CommandPermission("soc.parent") public class SomeOtherCommand extends BaseCommand { @Subcommand("foo") + @CommandPermission("soc.foo") public void onFoo1(Player player) { player.sendMessage("you foo'd"); }