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.
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.
{
"item": {
"commandUsage": {
"name": {}
}
}
}
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
permission
String
The permission of the command
type
String
Always Usage.class
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:
"name": {
"component": {
"text": "&6/item name &e[name] &7to rename your item.",
"showText": "&bClick to suggest",
"suggestCommand": "item name",
"color": "GRAY"
},
"permission": "item.name",
"type": "Usage.class"
Now, let's do the same thing for the other commands:
"commandUsage": {
"name": {
"component": {
"text": "&6/item name &e[name] &7to rename your item.",
"showText": "&bClick to suggest",
"suggestCommand": "item name",
"color": "GRAY"
},
"permission": "item.name",
"type": "Usage.class"
},
"clear": {
"component": {
"text": "&6/item clear &7to remove all the attributes of your team.",
"showText": "&bClick to execute",
"runCommand": "item clear",
"color": "GRAY"
},
"permission": "item.clear",
"type": "Usage.class"
},
"lore": {
"list": {
"component": {
"text": "&6/item lore list &7to show the lore your the item.",
"showText": "&bClick to execute",
"runCommand": "item lore list",
"color": "GRAY"
},
"permission": "item.lore.list",
"type": "Usage.class"
},
"add": {
"component": {
"text": "&6/item lore add &e[line] &7to add a line to your item lore.",
"showText": "&bClick to suggest",
"suggestCommand": "item lore add",
"color": "GRAY"
},
"permission": "lore.add",
"type": "Usage.class"
},
"remove": {
"component": {
"text": "&6/item lore remove &e[line] &7to remove a line to your item lore.",
"showText": "&bClick to suggest",
"suggestCommand": "item lore remove",
"color": "GRAY"
},
"permission": "lore.remove",
"type": "Usage.class"
}
}
}
Result
You can see the result by clicking on the page below.
Example of useLast updated