-
-
Notifications
You must be signed in to change notification settings - Fork 6
Create a Command Alias (0.0.9 to 0.2.0)
Yao Chung Hu edited this page Dec 28, 2021
·
1 revision
Command Aliases File will be located in config/commandaliases.json. If you are using Sublime Text, enable Regular Expressions with Alt+R and Case sensitive with Alt+C. Here is the pattern being used (\{(?<classTool>\w+)(::(?<method>[\w:]+))?(#(?<variableName>\w+))?(@(?<formattingType>\w+))?})
Here is an example with comments.
[
{
"command": "tools",
"_command": "Create a new command /tools",
"execution": [
{
"command": "give {this::SELF} minecraft:wooden_sword 1",
"_command": "{this::SELF} rebinds to the player who executes the /tools",
"type": "SERVER",
"_type": "CLIENT will execute the command client sided, if you don't have OP permissions, the command give won't be executed. SERVER will execute the command as the SERVER",
"messaage": "Giving Wooden Sword",
"_messaage": "Optional Message",
"sleep": "500",
"_sleep": "Sleeps in milliseconds, you can also specify an execution class tool on it"
},
{
"command": "give {this::SELF} minecraft:wooden_pickaxe 1",
"type": "SERVER"
},
{
"command": "give {this::SELF} minecraft:wooden_axe 1",
"type": "SERVER"
},
{
"command": "give {this::SELF} minecraft:wooden_shovel 1",
"type": "SERVER"
}
],
"message": "Here are some free wooden tools, {this::SELF}!",
"_message": "Optional Message that will be sent to the user, you can also specify an execution class tool on it"
},
{
"command": "sidebar {arg::objective#objective}",
"_command": "Creates /sidebar, required parameters are bound within {classTool::method#variableName}. This also creates the command with tab completion",
"execution": [
{
"command": "scoreboard objectives setdisplay sidebar {objective}",
"_command": "Our variableName is objective, any input in the place of {objective}",
"type": "SERVER"
}
],
"message": "Objective {objective} set for {this::SELF}!"
},
{
"command": "foo {arg::greedy_string#message}",
"execution": [
{
"command": "tellraw @a {\"text\":\"{message@jsonString}\"}",
"_command": "Calling format types with @, currently jsonString(escapes some characters), toLower, toUpper",
"type": "CLIENT"
}
]
}
]After editing the json you can run /commandAliases reload to reload them.
Argument types can be found here and here. There are some arguments that are currently unavailable.
You can also reassign existing commands using this format
{
"command": "help",
"_command": "The command literal to reassign",
"reassignOriginal": "minecraft:help",
"_reassignOriginal": "The new command literal to reassign to",
"reassignOnly": true,
"_reassignOnly": "This field isn't mandatory it's default value is false meaning you can directly create a command alias within this object. If you set this to true it will only reassign them and the the execution and message fields are ignored",
"execution": [
{
"command": "give {this::SELF} minecraft:wooden_sword 1",
"_command": "{this::SELF} rebinds to the player who executes the /tools",
"type": "SERVER",
"_type": "CLIENT will execute the command client sided, if you don't have OP permissions, the command give won't be executed. SERVER will execute the command as the SERVER",
"messaage": "Giving Wooden Sword",
"_messaage": "Optional Message",
"sleep": "500",
"_sleep": "Sleeps in milliseconds, you can also specify an execution class tool on it"
},
{
"command": "give {this::SELF} minecraft:wooden_pickaxe 1",
"type": "SERVER"
},
{
"command": "give {this::SELF} minecraft:wooden_axe 1",
"type": "SERVER"
},
{
"command": "give {this::SELF} minecraft:wooden_shovel 1",
"type": "SERVER"
}
],
"message": "Here are some free wooden tools, {this::SELF}!",
"_message": "Optional Message that will be sent to the user, you can also specify an execution class tool on it"
}You can also reassign existing commands using this format
{
"command": "foo {arg::brigadier:bool#bool} [arg::player#player@jsonString] [arg::greedy_string#message@jsonString]",
"_command": "You can set optional argument usings [] similar to required arguments",
"execution": [
{
"command": "tellraw @a {\"text\":\" {bool} [message] [player]\"}",
"_command": "If [message] or/and [player] is no entered by the user it is replaced by blank spaces",
"type": "CLIENT"
}
]
}- Home
- Command Aliases File
- Command Aliases Commands
- Command Modes for 0.3.0 and above
- Create a Command Alias (0.9.0)
- Create a Command Alias (0.8.0)
- Create a Command Alias (0.7.0)
- Create a Command Alias (0.5.0)
- Create a Command Alias (0.3.0 - 0.4.2)
- Create a Command Alias (0.0.9 - 0.2.0)
- Roadmap