Skip to content

Configurator Document

TRCStudioDean edited this page Jun 3, 2025 · 1 revision

Description

Configurator is a multifunctional configuration table management tool used to dynamically manipulate key value structures and perform operations such as adding, deleting, and modifying through preset configurator commands.
It supports reading configuration files locally and converting them into configuration tables, as well as saving configuration tables to local configuration files. And it supports you to retrieve the value at the specified path in the loaded configuration table through placeholders.
Basic Format: [ConfiguratorCommand]:[Parameters]...
If the expression already contains a colon : , you can escape it by adding a back slash \ in front to avoid recognizing the segment symbol. (For example \: )

Specify values in the table through placeholders or PAPI references: Click Here

Preset Commands

Command Name Operation
Create:[TableName] Create a new configuration table by name
Use:[TableName]:[Parameters] Configuration table operation
Delete:[TableName] Delete a specific configuration table by name
Load:[Parameters] Load configuration table
Save:[Parameters] Save configuration table into files

Create Configuration Table

Description: Create a configuration table with a specified name (only exists in cache, disappears after reloading the plugin)
Note: If the configuration table already exists, no operation will be performed
Format: Create:[TableName]

Configuration Table Operation

Description: Modify the specified configuration table
Format:
When storing * * [Value] * * in the configuration table, placeholders can be included; The default format is "text". If it is a number, it defaults to "number" format.
When performing a list operation, if the specified path is not a list or does not exist, it will be converted into a list.

Format Operation
Use:[TableName]:Set:[Path]:[Value] Set a value in the specified path
Use:[TableName]:Remove:[Path] Remove the value of the specified path
Use:[TableName]:ListAdd:[Path]:[Value] Add a value to the list of specified path
Use:[TableName]:ListSet:[Path]:[Index]:[Value] Modify the value of the Nth element in the list in the specified path
Use:[TableName]:ListRemove:[Path]:[Index] Remove the value of the Nth element from the list in the specified path
Use:[TableName]:ListClear:[Path] Clear the list in the specified path

Example:

Configurator:
- 'Use:[TableName]:Set:ExampleValue.Section1:Birthday'
- 'Use:[TableName]:Set:ExampleValue.Section2:20150811'
- 'Use:[TableName]:Set:ExampleValue.Section3:true'
- 'Use:[TableName]:ListAdd:ExampleValue.List:1th'
- 'Use:[TableName]:ListAdd:ExampleValue.List:2th'
- 'Use:[TableName]:ListAdd:ExampleValue.List:3th'

After saving to the configuration file:
YAML format

ExampleValue:
    Section1: 'Birthday'
    Section2: 20150811
    Section3: true
    List:
    - '1th'
    - '2th'
    - '3th'

JSON format

{
    "ExampleValue": {
        "Section3": true,
        "Section1": "Birthday",
        "Section2": 20150811,
        "List": [
            "1th",
            "2th",
            "3th"
        ]
    }
}

Delete Configuration Table

Description: Delete the configuration table with the specified name (reloading the plugin will also delete all loaded configuration tables)
Format: Delete:[TableName]

Load Configuration Table

Description: Load a configuration table directly by specifying parameters (without generating key values one by one through configurator command)
Format: Load:[Type]:[TableName]:[Parameters]
[Type] can be Text or File
Text refers to JSON text
File refers to local file
Currently recognizable file formats: YAML Format, JSON Format
[Parameters] Please fill in the required parameters for the corresponding type
Example:

Configurator:
- 'Load:File:Example1:plugins/LiteCommandEditor/Test.yml' #Overwrite the plugins/LiteCommandEditor/Test.yml file into the Example1 configuration table.
- 'Load:Text:Example2:{"ExampleValue": {"Section3": true,"Section1": "Birthday","Section2": 20150811,"List": ["1th","2th","3th"]}}' #Load this JSON text and overwrite it into the Exemple2 configuration table

Save Configuration Table

Description: Save the specified configuration table to the local directory with the specified file type
Format: Save:[TableName]:[FormatType]:[File]
[FormatType] can be JSON or YAML
If the specified file or directory does not exist, folders and files will be automatically created
Example:

Configurator:
- 'Save:Example:YAML:plugins/LiteCommandEditor/Test.yml' #Save the configuration table Example in YAML format to the plugins/LiteCommandEditor/Test.yml file
- 'Save:Example:JSON:plugins/LiteCommandEditor/Test.json' #Save the configuration table Example in JSON format to the plugins/LiteCommandEditor/Test.json file

Clone this wiki locally