Skip to content

Command Custom (0.9.0)

Yao Chung Hu edited this page Jul 10, 2022 · 1 revision

Command Custom

Prerequisites

Introduction

With the new release of 0.9.0 and later.

Let's get started.

Recapping a format with new features

  {
    "commandMode": "COMMAND_CUSTOM", // Required | Custom Command Format
    "customCommand": {
      "parent": "hello", // Required | Parent command 
      "permission": 0, // Optional | If LuckPerms is not installed will fallback to these permission level
      "message": "hello parent command", // 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
          "suggestionProvider": { // Optional | Suggestion Provider
            "suggestionMode": "DATABASE_STARTS_WITH", // Required | Suggestion Mode - List can be found here <Link>
            "suggestion": "$executor_name().home.suggestions" // Required | Suggestion
          },
          "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
            {
			  "id": "generic", 
              "triggerTime": "1000", // Optional | Default: None | Sets the trigger time for this action, in other words execute this action in `triggerTime`
              "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 | Sleeps the next action in miliseconds
              "unsuccesfulActions": [ // Optional | This set of actions gets executed if command fails
                // Action Component
              ],
              "succesfulActions": [ // Optional | This set of actions gets executed if command succeds
                // Action Component
              ]
            }
          ]
        }
      ],
      "actions": [
        // Action Component
      ]
    }
  }

Suggestion Provider

Suggestion Mode Description Command Aliases Version
DATABASE_STARTS_WITH Fetches a list of keys that starts with the suggestion, list key's value as a suggestion provider. 0.8.0
DATABASE_CONTAINS Fetches a list of keys that contains the suggestion, list key's value as a suggestion provider. 0.8.0
DATABASE_ENDS_WITH Fetches a list of keys that ends with the suggestion, list key's value as a suggestion provider. 0.8.0
JSON_LIST Uses suggestion as JSON string list as a suggestion provider. 0.8.0
COMMAND_LIST_LOOKUP Asks the server using a command as a suggestion. Requires using the vanilla command tree. 0.9.0
"suggestionProvider": { // Optional | Suggestion Provider
	"suggestionMode": "COMMAND_LIST_LOOKUP", // Required | Suggestion Mode - List can be found here <Link>
	"suggestion": "datapack enable name" // Required | Suggestion
}

Scheduler command

We can remove scheduled event actions using this command

  • commandaliases scheduler remove <id>
    • Removes action event with mentioned id.

Command Aliases Collection

Clone this wiki locally