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
Currently, it is possible to register commands using CommandDispatcher<S>.register but since that is an Unit function, there isn't a way to pass the LiteralCommandNode to brigadier's redirect function. Which leads to either duplicating the command code or not using the kotlin dsl in favor of the original java api.
Ideas
1- Keeping with the idea of sugaring the literal node, there could be an overload which takes a redirects: List<String> parameter.
I suggest simply make register exposes LiteralCommandNode and let others decide how they want to use it. Aliasing (depending how you define it) and redirection are two different concepts (aliasing can sometimes be achived by redirection but not always). The method node2.redirect(node1) simply add edges from node2 to all forward neighbours of node1, it does not copy all 'properties' of node1 to node2.
then it is natural to think running /foo, /foo2, and /foo3 all print "foo", but this is not what redirect does. So, care has to be taken when implementing such method.
something to note is that you can redirect to the middle of a command, e.g execute recursively redirects to it arguments to support all of them without creating a massive tree
its likely much better to implement a proper solution to this rather than assuming that people only ever want to redirect to a root command literal
Currently, it is possible to register commands using
CommandDispatcher<S>.register
but since that is anUnit
function, there isn't a way to pass theLiteralCommandNode
to brigadier'sredirect
function. Which leads to either duplicating the command code or not using the kotlin dsl in favor of the original java api.Ideas
1- Keeping with the idea of sugaring the
literal
node, there could be an overload which takes aredirects: List<String>
parameter.2 - Add a way to specify inside the
LiteralArgumentBuilder
redirects for the command being registered.3 - Just make
register
return theLiteralCommandNode
See Also
https://fabricmc.net/wiki/tutorial:command_redirects
The text was updated successfully, but these errors were encountered: