Panel Variables

Use variables to manipulate panels.

What are Panel Variables?

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.

Placeholder Variables

Creating placeholders

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.

'0':
  material: STONE
  commands:
  - 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 %cp-example1%.

Editing placeholders

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:

'7':
  material: BEACON
  commands:
  - placeholder= [%cp-mat%:BEACON]

Data Variables

Creating Data Variables

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.

Viewing Data Variables

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.

Setting Data Variables with Placeholders

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.

Some Tips

  • 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.

Last updated