diff --git a/vane-core/src/main/java/org/oddlama/vane/core/command/Command.java b/vane-core/src/main/java/org/oddlama/vane/core/command/Command.java index 651447e94..6468dc36a 100644 --- a/vane-core/src/main/java/org/oddlama/vane/core/command/Command.java +++ b/vane-core/src/main/java/org/oddlama/vane/core/command/Command.java @@ -55,9 +55,11 @@ public Plugin getPlugin() { @Override public boolean execute(CommandSender sender, String alias, String[] args) { + System.out.println("exec " + alias + " from " + sender); // Pre-check permission if (!sender.hasPermission(Command.this.permission)) { get_module().core.lang_command_permission_denied.send(sender); + System.out.println("no perms!"); return true; } @@ -76,7 +78,7 @@ public boolean execute(CommandSender sender, String alias, String[] args) { @Override public List tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { - // Don't allow information filtration! + // Don't allow information exfiltration! if (!sender.hasPermission(getPermission())) { return Collections.emptyList(); } @@ -145,9 +147,9 @@ public Command(Context context, PermissionDefault permission_default) { bukkit_command.setLabel(name); bukkit_command.setName(name); - + aliases = getClass().getAnnotation(Aliases.class); - brigadier_command = Commands.literal(name).requires(stack -> stack.getSender().hasPermission(permission)); + brigadier_command = Commands.literal(name); if (aliases != null) { bukkit_command.setAliases(List.of(aliases.value())); } @@ -178,7 +180,11 @@ public LiteralArgumentBuilder get_command_base() { } public LiteralCommandNode get_command() { - return get_command_base().build(); + var cmd = get_command_base(); + var old_requirement = cmd.getRequirement(); + return cmd + .requires(stack -> stack.getSender().hasPermission(permission) && old_requirement.test(stack)) + .build(); } public List get_aliases() { @@ -187,7 +193,7 @@ public List get_aliases() { } else { return Collections.emptyList(); } - + } @Override @@ -214,5 +220,5 @@ public int print_help2(CommandContext ctx) { public LiteralArgumentBuilder help(){ return literal("help").executes(ctx -> {print_help2(ctx); return SINGLE_SUCCESS;}); } - + } diff --git a/vane-trifles/src/main/java/org/oddlama/vane/trifles/commands/Setspawn.java b/vane-trifles/src/main/java/org/oddlama/vane/trifles/commands/Setspawn.java index 35e7b6de0..b12e46b4c 100644 --- a/vane-trifles/src/main/java/org/oddlama/vane/trifles/commands/Setspawn.java +++ b/vane-trifles/src/main/java/org/oddlama/vane/trifles/commands/Setspawn.java @@ -23,7 +23,7 @@ public class Setspawn extends Command { public Setspawn(Context context) { super(context); } - + @Override public LiteralArgumentBuilder get_command_base() { return super.get_command_base()