Mojang / brigadier

Brigadier is a command parser & dispatcher, designed and developed for Minecraft: Java Edition.
MIT License
3.44k stars 392 forks source link

require in suggestions LOL #99

Open DietrichPaul opened 3 years ago

DietrichPaul commented 3 years ago

i got bored and wanted to change the bukkit command system to brigadier's in 1.8 xD. Now i am facing the following problem: if a literalargumenttype was registered with require in the dispatcher, it will still be displayed in suggestions if require is returning false 😒 if I have done something wrong, please tell me 😂.

image image image

xhyrom commented 3 months ago

https://github.com/Mojang/brigadier/blob/b92c420b2a292dd5c20f6adfafff5e21b9835c6d/src/main/java/com/mojang/brigadier/CommandDispatcher.java#L538-L544

there could be something like this:

if (!node.canUse(context.getSource())) {
    futures[i++] = Suggestions.empty();
    continue;
}