Variables
Last updated
Last updated
As a miscellaneous tool, this plugin supports internal variables. These variables can be set inside actions or through a command by admins and then used to check conditions inside tooltips.
Variables have a target, persistence and are defined through key-value pairs. For example, you can have a variable named "meow
" equal to "true
" or "amount
" equal to 5
.
Below is a reference table, which shows where and how variables can be used;
If you want to modify variables, you can do it:
Inside tooltips' , using For example:
Externally (outside of actions), using the
For example:
/tt vars setvar Septicuss cool true
If you want to use variables in conditions (to check something)
If you want to use variables in tooltips text
If you want to display variables outside of Tooltips in other plugins
There are persistent and non-persistent variables. Persistence means that variables are saved into files and kept around. Non-persistent variables are reset on server restart, persistent variables can only be cleared through the proper commands.
Variable commands define a scope, which defines who this variable will be set for.
Global
A global variable applied to all players.
Player
The current player. For example, if this scope is used in actions, the action command will be executed for the player with an active tooltip.
<Player_Name>
An online players name. Using this will set it only for a specific player.
Setting the variable supports mathematical expressions, which can utilize PAPI placeholders and local placeholders. Examples:
Using PlaceholderAPI placeholders has been made as simple as possible. Placeholders are dynamic, and you have to build them using keys:
v
variable (always required)
g
global
p
persistent
%tooltips_[KEY]_[ID]%
[KEY] -> multiple keys combined in any order
[ID] -> ID of the variable being requested
Get the player variable "cool"
%tooltips_v_cool%
Get the global variable "cool"
%tooltips_gv_cool%
Get the persistent player variable "tutorial_passed"
%tooltips_pv_tutorial_passed%
Get the persistent global variable "views"
%tooltips_pgv_views%
Use the with For example:
Use the For example:
Use
For example:
/papi parse Septicuss %tooltips_v_cool%