Command aid system
This is a guide to learn how to create an advanced command aid system.
Advanced command aid system
What is it ?
An advanced command aid system is an aid sent to a user when he makes a mistake in a command. This system will search the commands the most closest from the command sent and it will send them to the user to help him.
It will also allow the user to click on the messages sent to execute commands faster or to be sure that their spelling is correct.
Create it
To create an advanced aid system for a command, you must first know what your command will do. In this guide, I will create an item command which will allow users to modify their items in game. So I will create these different commands:
/item name [name]
/item clear
/item lore list
/item lore add [line]
/item lore remove [line]
Now, to create your aid system, we will create one JsonObject
per argument of the command and in the order in which they must be written by the user. Let's create it for the first command.
You can see that name if an argument of my command so I will create an object called "name" is the commandUsage
section.
Arguments can also be written in square brackets
or between the symbols <
and >
. These notations are very important to use the automatic tab completer.
Usage properties
Now, let's add properties and values which will be showed to users and he makes a mistake in our command. The available properties are:
Property | Type | Description |
|
| The usage of the command (see here for more information) |
|
| The permission of the command |
|
| Always |
The permission property is the permission of the command. It is used by both the command aid system and the automatic tab completer to know if messages and completions can be sent to the user.
type
property is mandatory and must always be Usage.class
. It says to the system to read the current object as a Usage
object and that there are no other under paths.
Example
Let's see an example for the /item name
command:
Now, let's do the same thing for the other commands:
Result
You can see the result by clicking on the page below.
pageExample of useLast updated