Use variables to manipulate panels.
Panel variables are custom placeholders or data from one panel that can be used in another panel. These variables essentially carry across values from one panel to another or can be saved permanently for the plugin to remember next time a panel is opened.
To define a placeholder and its value, use the following command. You will need to enter the panel name you want to open, then the following words should follow this format:
[placeholder:value]The placeholder values can contain spaces, and the placeholders themselves should not have capital letters.
- open= panel-3 [example1:PlaceHolder Value] [mat:STONE]
- msg= The value of the placeholder is %cp-example1%
Once the placeholders have been defined, use it wherever you want in the panel you want to open. In the example above, the placeholder is
example1which means you will use
If you want to edit a placeholder in the current panel, you cannot use open= as shown above. Instead, change open= to placeholder= and use the same process, this will allow you to edit placeholders in the current panel. You will only need to define the certain placeholder/s you are editing, any other placeholders will stay the same if they are not added. For example, using the example above, if panel-3 was opened and you wanted one of the items to change the placeholder %cp-mat% to BEACON instead, you would use the following command:
- placeholder= [%cp-mat%:BEACON]
These variables are more permanent than the placeholder variables above. These values will be saved permanently to file even if the server is restarted. You will need to use one of the following Command Tags to set a value.
add-data= [dataName] [value] [optional player]
Using this will not overwrite old data but if the player does not have data set for this dataName, it will write the value to it. This is useful to place in the commands-on-open section of a panel, to ensure data has been set before continuing to use the panel.
set-data= [dataName] [value] [optional player]
Using this will set data to a new value even if the dataName already has a value.
del-data= [dataName] [optional player]
This will permanently delete a specific value for a player. This means the add-data tag can be used because no data exists anymore in the certain dataName for the player.
clear-data= [player name]
This will clear out all of the data that a player may have saved. You can use %cp-player-name% to specify the player who has opened the panel.
math-data= [dataName] [operation] [optional player]
Used to change numeric data. Usage:
math-data= [dataName] [operation]. There are only four types of operations,
+ - * /. You should put one operation at the start and a number at the end, some examples as an operation:
/5. It will take the current number stored and add the operation to it.
To view a data variable, you will simply just have to use the following placeholder.
%cp-data-[dataName]%replace [dataName] with the name of the data you want to view.
%cp-data-[dataName],[playerName]%to view other players data.
Data can be manipulated using placeholders as well. See the following placeholder
%cp-setdata-[dataName],[newValue]%replace [dataName] with the name of the data you want to edit.
- If you open the panel directly without defining a variable, the placeholders will show up raw without any values when trying to view them.
- To make items look different depending on the placeholder value, use a hasvalue section in order to change the item to anything you want.
- The data keys/names should not have capital letters.