Server Plugins
Creating Commands
Learn how to create custom commands for your Hytale mod.
Creating a command is easy. You need to extend the CommandBase class.
Command Class
public class ExampleCommand extends CommandBase {
public ExampleCommand() {
super("example", "A example command", false);
}
@Override
protected void executeSync(@Nonnull CommandContext context) {
context.sendMessage(Message.raw("Hello from ExampleCommand!"));
}
}Registering the Command
To register your command, you need to add it to the command manager in your plugin's main class:
public class MyPlugin extends JavaPlugin {
@Override
public void setup() {
getServer().getCommandManager().registerCommand(new ExampleCommand());
}
}Written by Neil Revin