Skip to content

Command Custom (0.8.0)

Yao Chung Hu edited this page Jul 10, 2022 · 4 revisions

Command Custom

Prerequisites

Introduction

With the new release of 0.8.0 and later, we can now add suggestion providers to over argument type children.

Let's get started.

Recapping a format with new features

  {
    "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
          "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
            {
              "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
      ]
    }
  }

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
"suggestionProvider": { // Optional | Suggestion Provider
	"suggestionMode": "DATABASE_STARTS_WITH", // Required | Suggestion Mode - List can be found here <Link>
	"suggestion": "$executor_name().home.suggestions" // Required | Suggestion
}

Gist of commands from Command-Custom-(0.7.0) with suggestion providers

Clone this wiki locally