Placeholder for custom data
A placeholder that allows you to save, delete and obtain variables for players, coordinates and entities (in a file or temporarily).
Meaning
Allows you to save, delete and obtain variables for players, coordinates and entities (in a file or temporarily).
Format
%CEP_customData_<action>_<name>_(semi-mandatory) <data>_(optional) <entity_uuid|player_name|world,x,y,z>%
<action> – may be set, remove, get, getset, increase, decrease, multiply or divide, "getset" is needed to get a variable if it exists or set it if it does not exist, "incease", "decrease" "multiply" and "divide" are needed for the numerical values to perform mathematic operations on them, before the action you can write “temp” (for example: "tempset"), then instead of perpetual variables temporary variables will be used, which will be stored until the server restarts; (MANDATORY)
<name> – the name of the variable (do not use underscores); (MANDATORY)
<data> – the data to save in the variable (only in case of "set", "getset", "incease", "decrease" "multiply" and "divide" actions); (SEMI-MANDATORY)
<entity_uuid | player_name | world,x,y,z> – the target which own the variable (if no target is specified, a global variable will be used). (OPTIONAL)
Use "ᵕ" symbol instead of underscores in <data>!
The perpetual variables and temporary variables are different! The same variables names will point to different variables.
You will get back the specified or saved data in any case, nevermind using the "get" or "set". In case of "remove" you will get "true" or "false" depending on the removing result. In case of "incease", "decrease" "multiply" or "divide" you will get back the result of the operation or "NotANumber" if your data or saved data is not a number or does not exist.
You can also use String expansion from PlaceholderAPI and its "%string_substring_<startIndex>,<endIndex>_<string>%" placeholder to trim your data placeholder to the zero characters if you do not want to get the data back.
If "temp" prefix will not be specified in the action, the variable will be stored in a file at the path plugins/TriggerReactor/var.json (you can change this file, changes will take effect after the command /trg reload confirm), otherwise the variable will be stored in the server memory until it is restarted.
Where is useful
Can be useful in many cases to save, change, delete and obtain different data for different objects in a comfortable way. It can be used in many different systems and mini-games.
For example, in ConditionalEvents conditions, when you need to use %random_<min>_<max>% placeholder and save its output right in the conditions for further using without regenerating the random number.
Examples
%CEP_customData_set_coins_2_{player}% # Set some "coins" data to "2" for the current player
%CEP_customData_tempgetset_taxes_100_world,643,54,1542% # Set temporary variabe as some "taxes" data if it does not exist to "100" or get the current value otherwise for some block at the location
Last updated