Add support for tab completing and highlighting console input from the Brigadier command tree#5437
Conversation
|
OMG, waited for this feature so long, I love it! Have to be inside of paper-api |
|
nice to see this make its way to paper :) I think an event is unnecessary since plugin devs can already provide completions with the brig api and the event as it stands reeks of implementation detail also, when I implemented this I ran I to some situations where it seemed like the ranges on brig nodes were out of bounds for the input string, not sure why. iirc I was able to get this with |
|
Honestly I'd prefer an event over forcing brig. Unfortunately brig doesn't allow for everything that plugins may want to use in commands and adapting to it causes loss of functionality (flags and mid-command optionals to name a few). That said I'm not sure if this needs to be console-limited. Would be cool to have component completions for in game commands too (again, short of relying on brig). iirc when DemonWav played around with this for paperd he just hooked off the existing event (albeit didn't support components) and it worked pretty well. |
It seems like the |
I think I am mostly in agreement about the event, it basically is an implementation detail. This line prevents the out of bounds issue: https://github.com/PaperMC/Paper/pull/5437/files#diff-7f71fa74f053b28e5f753d6db8dff2530b32fa0369b2c0ed2e7bacbb28183247R231 |
Unfortunately the counterpart here is actually AsyncTabCompleteEvent. The SendSuggestions event happens at a different point in the command lifecycle and requires a complete second pass at processing essentially. I suppose what I'm saying is that I think components should be added to AsyncTabCompleteEvent instead of making a new event. Dunno how break-y that'd be though. |
|
That was something i asked jmp to look at doing as well -- but it sounded like there wasn't any nice way to shove tooltips into there. |
2773638 to
e224499
Compare
|
Something like that might be possible but I think it's out of scope for this PR. |
e224499 to
652c743
Compare
|
I've removed the event, as I agree with zml that it's too much of an implementation detail. This PR should be "ready for review" now. |
6b0d2e3 to
f02203a
Compare
f02203a to
fe66c6e
Compare
fe66c6e to
10e7a2b
Compare
JRoy
left a comment
There was a problem hiding this comment.
Tested with latest EssentialsX which tampers with CommandMap quite a bit and this works!
|
Looks hot and works well from my testing 🐱🏍 |
|
Looks hot and works well from my testing too 🐱🏍 |
…e Brigadier command tree
10e7a2b to
e35388d
Compare
…e Brigadier command tree (PaperMC#5437)
…e Brigadier command tree (PaperMC#5437)

Adds support for tab completing and highlighting console input from the Brigadier command tree. This works with vanilla commands, regular bukkit commands, as well as bukkit commands that have registered with Brigadier using Commodore/
CommandRegisteredEvent.Screenshot:
