Skip to content

Create a new command

André edited this page Apr 8, 2019 · 4 revisions

For this tutorial, will try to create a simple new /welcome command (without args), which will send multiple message in chat.

Config.yml part

To create a new command, edit in the config.yml file, and add a new YAML list in 'commands' node, like this:

commands: 
  welcome:
  - ''

First, we have to put the options we want for the command. Let's say we'll need "mycommand.welcome" permission, just add it like this:(optional!)

commands: 
  welcome:
  - '%permission%mycommand.welcome'

After this, we can use the %say% utility to send messages in chat, like this:

commands: 
  welcome:
  - '%say%&l&aHello, welcome to our server!'
  - '%say%&aThis is a simple survival server. Use /kit info to get a book!'
  - '%say%&2You can visit our website for more informations.'

Commands.yml part

Just add the alias in commands.yml now (in your server folder), like this:

aliases:
  welcome:
  - commandexecutor welcome

Your command is now saved! When you enter /welcome command, it will execute /commandexecutor welcome, and will execute all listed commands in the config.yml

N.B: if you edit the config.yml, don't forget to /commandexecutor reload in game!

N.B2: if you edit the commands.yml, don't forget to /reload your server!

N.B3: list of available option & utilities here

Clone this wiki locally