Skip to content

fix: command permissions not visible to Bukkit and tab completion errors - #210

Open
DragonL0508 wants to merge 1 commit into
FairyProject:v0.7from
DragonL0508:fix/command-permission-and-completion
Open

DragonL0508 wants to merge 1 commit into
FairyProject:v0.7from
DragonL0508:fix/command-permission-and-completion

Conversation

@DragonL0508

Copy link
Copy Markdown
  • Permissions: BukkitCommandExecutor never told Bukkit about the command's permission, so every command was in every player's command tree: players without access still saw admin commands in the suggestions after /. testPermissionSilent now asks BaseCommand#canAccess, the same check used before executing.
  • @Wildcard completion: CommandMeta#completeCommand looked up arguments.get(args.length - 1), which throws IndexOutOfBoundsException as soon as more words are typed than there are parameters. It now keeps completing with the wildcard argument.
  • Completion errors: any exception thrown while tab completing went to onError, which sends Internal Exception: ... to the sender on every key press. It is now logged and the completion is empty.

Tests: BukkitCommandExecutorTest (permission follows canAccess, completion errors don't reach onError) and CommandMetaTest (wildcard completion past the parameter count).

🤖 Generated with Claude Code

- BukkitCommandExecutor never told Bukkit about the command's
  permission, so every command was listed in every player's command
  tree: players without access still saw admin commands in the
  suggestions after "/". testPermissionSilent now asks
  BaseCommand#canAccess, the same check used before executing.

- CommandMeta#completeCommand with a @wildcard last parameter looked up
  arguments.get(args.length - 1), which throws IndexOutOfBoundsException
  as soon as more words are typed than there are parameters. It now
  keeps completing with the wildcard argument.

- Any exception thrown during tab completion was passed to onError,
  which sends "Internal Exception: ..." to the sender on every key
  press. It is now logged and the completion is empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant