Open NorbiPeti opened 4 years ago
I was also thinking about that but I read a discussion on Lucko’s Discord (see link in readme) about exploiting the .suggests()
method of Brigadier and having an option in Commodore to disable suggestion overriding.
One option would be to add an optional boolean parameter to the register(Command, LiteralCommandNode)
to keep the original Commodore behavior or keep the suggestions data put in the CommandNode and sub nodes.
Another option, while keeping current behavior of the Commodore API, is to not override the suggests
field of a node if it was already set to something before calling Commodore#register(...).
I saw also this git branch that kind of let the plugin developer choose when the client should not ask the server for completion, but this functionality should be improved even more I think
for now, in my plugin, I am just using the #register(LiteralCommandNode)
method to have a better control of the suggestion process, but I loose the alias management provided by Commodore :/
EDIT : @lucko I made 2 branch on my fork to suggest two alternatives to provide better control of the suggestions data.
#register(Command, ...)
so the plugin developer will have the choice to disable the application of CraftBukkit SuggestionProvider. | original behavior of Commodore | patch-custom-suggests | patch-custom- suggests-2* |
---|---|---|---|
no .suggests() | Bukkit TabCompleter | Bukkit TabCompleter | not asking server |
.suggests(custom suggests) | Bukkit TabCompleter | custom suggests | custom suggests |
.suggests(Suggestions .dontAskServer()) | -- | not asking server | -- |
*with optional parameter = false (the default being true, the original behavior of Commodore)
Let me know which one is the best (+ eventual improvement), I will do a pull request after that :)
I'm using a custom suggestion provider for the arguments so I'm using
#register(LiteralCommandNode)
but I've discovered that it leavesminecraft:command
tab completion in (I also registerplugin:command
so I get aminecraft:plugin:command
option as well). If I use#register(Command, LiteralCommandNode)
then it replaces my suggestion provider with Bukkit's. An option would be useful in this case where I can let Commodore deal with Bukkit's things but let me use the vanilla method.