Commands
In Quartz, commands are not implemented in the framework itself. Instead, the framework includes a transitive dependency: Funmands. Funmands is a declarative command framework for Minecraft, and is built by the same team behind Quartz. The reason it is not included in Quartz itself is because Bedrock is built for Paper, whilst Funmands is designed to be platform-agonstic and run on any environment that has brigadier, including Paper, Velocity, Fabric, and Forge. With that being said, let’s make a command using Funmands:
public class ExampleCommand extends PaperCommand { public ExampleCommand() { super("example", "An example command.", "e", "ex");
this.addFormat("", ctx -> { ctx.getExecutor().sendMessage("this is executed when a sender does /example, /e, or /ex!"); });
this.addFormat("target:player", ctx -> { final Player target = ctx.get("player"); ctx.getExecutor().sendMessage(target.displayName()); }); }}Now, let’s register it:
PaperFunmandsManager commandManager = new PaperFunmandsManager(this.getLifecycleManager());
commandManager.registerCommand(new ExampleCommand());If you would like more detail on Funmands, visit the docs.