CraftTweaker

CraftTweaker

151M Downloads

Create custom commands through ZenScript

PrincessRTFM opened this issue ยท 2 comments

commented

Feature request name
Define custom client/server side commands

Feature request description
Minecraft has both client and server sided commands. Currently, scripts can access the server's command manager, which allows examining all commands and executing a command string (as well as tab completion and allowed commands for a given command sender) but there is neither a way to view client-sided commands nor to register a new command. A ZenScript ICommandAction interface, for instance, could accept the IPlayer (or ICommandSender) that triggered it, a string holding the name of the command (so that one function may handle multiple commands, or aliases can imply options), and either a string containing the remaining arguments or a string[] containing the remaining arguments split on whitespace. This would be most useful with access to standard string library functions as well, of course.

Feature request reason
It would allow scripters and pack makers to define entire, arbitrary actions to be triggered on a user command, including the ability to invoke other commands via server.commandManager.executeCommand(ICommandSender, string). This would enable batch-like commands, with all of the logic and information available within CraftTweaker, combined with the ability to modify many other parts of the game, all in an easy to understand and write language that doesn't require a custom mod.

Feature request dependencies
This would require write access to the server command manager, as well as the existing read access. A wrapper would almost certainly be required to interface between minecraft's command classes and ZenScript. This would be pure vanilla and require no additional libraries or mods.

commented

I am a bit hesitant to do this one, while it has been done before, it caused a lot of issues with script reloading and sponge / servers. Script reloading will be a thing in 1.14 and I don't really want to add a features just to remove it in an update.

commented

Script reloading is coming back?