Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Shortening Commands (Aliases)

Angel Avila edited this page Aug 5, 2020 · 1 revision

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.

Disclaimer

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.