This repository was archived by the owner on Jan 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
This repository was archived by the owner on Jan 6, 2025. It is now read-only.
Command Builder #2
Copy link
Copy link
Closed
Labels
suggestionNew feature or request/suggestionNew feature or request/suggestion
Description
So what we have now for the CommandBuilder class is quite literally nothing important, it is basically the exact same as the CommandExecutor class.
So, I was thinking of something like this:
- Without Arguments:
CommandBuilder cmd = new CommandBuilder("test")
.setPermission("test.command")
.setUsage("Correct Usage: /<command>")
.setDescription("This command is a test. This is also shown in /help testcommand")
.setShortDescription("This is a short description shown in /help testcommand")
.setAliases("testcommand")
.addAlias("testing")
.setExecutor((CommandSender sender, CommandArguments args) -> {
sender.sendMessage("Just some random implementation.");
return;
})
.register();- With Arguments:
CommandBuilder cmd = new CommandBuilder("broadcast")
.setArguments(new JoinedStringArgument(0)) // Special characters can be used and can have spaces.
.setPermission("broadcast.command")
.setUsage("Correct Usage: /<command> <message>")
.setDescription("Broadcasts the message set in the arguments of the command.")
.setShortDescription("Broadcasts a message.")
.setAliases("bc")
.addAlias("broadcastmsg")
.setExecutor((CommandSender sender, CommandArguments args) -> {
if (args.get(0) == null) {
sender.sendMessage("Correct Usage: /broadcast <message>")
return true;
}
Bukkit.broadcastMessage("BROADCAST: " + args.get(0));
return true;
})
.register();Metadata
Metadata
Assignees
Labels
suggestionNew feature or request/suggestionNew feature or request/suggestion