bundabrg / bcf

BCF Command Formatter
https://bundabrg.github.io/bcf/
GNU General Public License v3.0
6 stars 2 forks source link

Commands and subcommands descriptions #21

Open Lemar98 opened 2 years ago

Lemar98 commented 2 years ago

In the commandAPI plugin (https://github.com/JorelAli/CommandAPI) I saw an interesting feature: when the player moves his mouse over one of the tooltips in tabcomplete, he is shown some kind of message that is predefined in the class. Is it possible to do the same with your api? The documentation mentions the @Description annotation, but I still don’t understand what it is for, because it doesn’t output anything to the game warps

bundabrg commented 2 years ago

I'm overhauling this library to support these sort of descriptions so hopefully in the very near future.

bundabrg commented 2 years ago

simplescreenrecorder-2022-10-01_15 45 38

V2.0.0-SNAPSHOT supports this now. I'm close to merging this to master. The only requirement is that it'll do the tooltips if you have ProtocolLib installed otherwise will fallback to the non-tooltip method as I can't use brigadier directly since its too limiting for some features I want to support.

Edit: The annotations for the above are:

image

By default tooltips use the 'description' part of the Arg string, however you'll note the Portal Types (this is for another plugin of mine called PortalNetwork will override the description and instead give the actual portal names since it has its own parser it provides called @portaltype.

The only thing I can't do is have Brigadier errors come up as you're typing since I can't create a Brigadier argument tree as its requires that its built when the player joins whereas BCF does it dynamically when the command is parsed. This is because the dynamic part of the system means I have no idea how many arguments there could be (it could change based upon the input) and is especially noticeable with switches that can move to any part of a command (IE, the -type part of the command in the preview).