-
Notifications
You must be signed in to change notification settings - Fork 8
Shortening Commands (Aliases)
Commands like '/chatcontrol ignore swears' are long and can be annoying. In the following example, I illustrate how you can allow the players to just type '/swears' instead. Let's take advantage of Bukkit's file named commands.yml and create the following inside it:
aliases:
swears:
- chatcontrol ignore swears
The change applies after restarting the server. Now, you can use the command '/swear' to run the long command. You can also launch several commands, if you specify them on new lines.
Sometimes you may want to parse all arguments from the original command, for example the global chat message. This example will satisfy:
aliases:
shout:
- "chatcontrol global $1-"
Whenever players type /shout [...], the command will be executed as /chatcontrol global [...] with the message they have typed.
It's important to mention that commands.yml can be somehow very limited as its abilities are very basic and flat and may not be able to support more advanced stuff such as placeholders. Therefore, another solution would be installing an additional plugin specialized in the creation of Custom Commands, or use alias system from plugins like CMI.
© MineAcademy | Code Unique Minecraft Plugins & Servers In 20 Days
About
Free version
Basics
Understanding
- Channels
- Formatting
- Rules / Filters
- Handlers
- Groups
- JSON
- Discord
- Toggle ignoring swears
- Variables
- JavaScript Variables
Tweaking
Solving Issues
Miscellaneous