-
-
Notifications
You must be signed in to change notification settings - Fork 6
Command Custom (0.7.0)
Yao Chung Hu edited this page Jul 5, 2022
·
12 revisions
With the new release of 0.7.0 and later, we can finally store values and this will allow us to create a lot of new custom commands.
Let's take a look at what new features were included.
- New database commands and compute commands
- New function processor
- A simple implementation of the Permission API that you can use alongside LuckPerms
- The child component now has a list of
unsuccessfulActionswhich allows running those actions if the command fails - The child component also has 2 new fields for
successfulMessageandunsuccessfulMessagewhich allows for messages depending on if the command failed or not
Let's get started.
{
"commandMode": "COMMAND_CUSTOM", // Required | Custom Command Format
"customCommand": {
"parent": "hello", // Required | Parent command
"type": "literal", // Redundant | Type of command
"permission": 0, // Optional | If LuckPerms is not installed will fallback to these permission level
"message": "hello parent commnad", // Optional | Executor gets a local message if parent command is executed
"children": [ // Optional | List of sub commands
{
"child": "name", // Required | Sub command placeholder
"type": "argument", // Required | Type of sub command literal or argument
"argumentType": "minecraft:word", // Required | Argument Type
"permission": 0, // Optional | If LuckPerms is not installed will fallback to these permission level
"message": "Hello name sub command", // Optional | Executor gets a local message if child command is executed
"children": [ // Optional | List of sub commands
// Child component
],
"actions": [ // Optional | List of actions
{
"command": "say Hello {{name}}", // Optional | Command to execute will be processed to map variables and process functions
"commandType": "SERVER", // Optional | Required if command is present
"message": "We tried said hello {{name}}", // Optional | Executor gets a local message
"successfulMessage": "We said hello {{name}}", // Optional | Executor gets a local message if command success
"unsuccessfulMessage": "We failed to say hello {{name}} somehow", // Optional | Executor gets a local message if command fails
"requireSuccess": true, // Optional | Default: false | If set to true prevents the execution of the next action if this action command fails
"sleep": "1000", // Optional | Default: None
"unsuccesfulActions": [ // Optional | This set of actions gets executed if command fails
// Action Component
]
}
]
}
],
"actions": [
// Action Component
]
}
}We are using a key-value database. You can read more about key-value databases on Wikipedia.
-
commandaliases database put <key> <value>- Stores entry of a key-value into the database of the world directory, there is no user output
-
commandaliases database delete <key>- Deletes entry of a key from the database of the world directory, there is no user output
-
commandaliases database contains <key>- Returns success internally if the database of the world directory contains a key, there is no user output
-
commandaliases database get <key>- Prints key if the key exists with the database of world directory, meant for debugging purposes
These commands are simple mathematical operations for storing them in the database.
-
commandaliases compute equals <value1> <value2>- Returns
1(all successful commands will return 1 by default this is howrequireSuccessworks by checking the the command was executed successfully) internally ifvalue1is equal tovalue2
- Returns
-
commandaliases compute addition <key> <value1> <value2>- Stores the value of
value1 + value2into database ofkey
- Stores the value of
-
commandaliases compute subtraction <key> <value1> <value2>- Stores the value of
value1 - value2into database ofkey
- Stores the value of
-
commandaliases compute multiplication <key> <value1> <value2>- Stores the value of
value1 * value2into database ofkey
- Stores the value of
-
commandaliases compute division <key> <value1> <value2>- Stores the value of
value1 / value2into database ofkey
- Stores the value of
-
commandaliases compute modulus <key> <value1> <value2>- Stores the value of
value1 % value2into database ofkey
- Stores the value of
As of 0.7.0
-
$executor_name()- Returns the player name of the command executor.
-
$get_database_value(key)- Returns the value of
keyfrom the database if it exists. Example:commandaliases database put hello.key world.valuethensay $get_database_value(hello.key)and it will say in chatworld.value
- Returns the value of
-
$get_dimension(player)- Returns the dimension registry key of the player in the argument. Example:
say $get_dimension(jeb_)and it will say in chatminecraft:overworld
- Returns the dimension registry key of the player in the argument. Example:
-
$get_pos_x(player)- Returns player position x in the argument. Example:
say $get_pos_x(jeb_)and it will say in chat10.25
- Returns player position x in the argument. Example:
-
$get_pos_y(player)- Returns player position y in the argument. Example:
say $get_pos_y(jeb_)and it will say in chat64.5
- Returns player position y in the argument. Example:
-
$get_pos_z(player)- Returns player position z in the argument. Example:
say $get_pos_z(jeb_)and it will say in chat-10.25
- Returns player position z in the argument. Example:
-
$get_yaw(player)- Returns player yaw in the argument. Example:
say $get_yaw(jeb_)and it will say in chat0
- Returns player yaw in the argument. Example:
-
$get_pitch(player)- Returns player pitch in the argument. Example:
say $get_pitch(jeb_)and it will say in chat90
- Returns player pitch in the argument. Example:
-
$get_block_pos_x(player)- Returns player block position x in the argument. Example:
say $get_block_pos_x(jeb_)and it will say in chat10
- Returns player block position x in the argument. Example:
-
$get_block_pos_y(player)- Returns player block position y in the argument. Example:
say $get_block_pos_y(jeb_)and it will say in chat64
- Returns player block position y in the argument. Example:
-
$get_block_pos_z(player)- Returns player block position z in the argument. Example:
say $get_block_pos_z(jeb_)and it will say in chat-10
- Returns player block position z in the argument. Example:
When you have LuckPerms installed the default permission key will be <parent_name>.<child_name_if_any>.<child_name_of_child_if_any> recursively.
Wiki Explanation and Home commands
TPA commands
- 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

