You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Brigadier, suggestions are able to have a Message tooltip, which will be shown to users when hovering over the suggestion. Minecraft's Component implements Message, so to get a Message from a Component is as simple as SpongeAdventure.asVanilla(Component).
A possible way to implement this would be replacing String based suggestion APIs with something like a Completion, which would be a holder for a string suggestion, and a nullable Component tooltip. The implementation can then decide how to deal with these Completions.
In addition it would be nice to expose an API for converting Component to Message, for plugin developers who want to use the Brigadier registrar.
The text was updated successfully, but these errors were encountered:
A possible way to implement this would be replacing String based suggestion APIs with something like a Completion, which would be a holder for a string suggestion, and a nullable Component tooltip. The implementation can then decide how to deal with these Completions.
That'd be my way of doing it too.
In addition it would be nice to expose an API for converting Component to Message
Well, given Message is not in the API, no. If you were directly attaching to Brig using that registrar, you wouldn't need to do that anyway (though from what I remember, what you've linked to is just a way to fulfil the requirements of the registrar and that a completion via a stock Brig node is not going to go through that unless you pull it through that registrar).
Of course, I'm going to have to do something in impl to make that conversion, so anyone using Brig should just depend on the impl anyway because we make no guarantees that Brig is used in the background.
In Brigadier, suggestions are able to have a
Message
tooltip, which will be shown to users when hovering over the suggestion. Minecraft'sComponent
implementsMessage
, so to get aMessage
from aComponent
is as simple asSpongeAdventure.asVanilla(Component)
.This capability is not exposed to API however. In fact, when using the
BrigadierCommandRegistrar
, these tooltips will be lost: https://github.com/SpongePowered/Sponge/blob/0ca0e644f4e3b233f127ee936f5cfee29f0ba62c/src/main/java/org/spongepowered/common/command/registrar/BrigadierCommandRegistrar.java#L198-L199A possible way to implement this would be replacing String based suggestion APIs with something like a
Completion
, which would be a holder for a string suggestion, and a nullableComponent
tooltip. The implementation can then decide how to deal with theseCompletion
s.In addition it would be nice to expose an API for converting
Component
toMessage
, for plugin developers who want to use the Brigadier registrar.The text was updated successfully, but these errors were encountered: