- In MagicSpells, you can use variables to store information. Variables are defined by their name and the type of information they contain.
- Variables can be defined in the
general.yml
file or any spell file. The main configuration looks like this:
variables:
(varName):
type: . . .
# (Variable configuration)
- The variable name should be meaningful to its use and only contain word characters (a-z +
_
).
- Learn how to modify variables here.
Option |
Description |
Type |
Default |
type |
Defines the information the variable can contain. Valid types can be found below.
|
String |
"global" |
permanent |
Defines if this variable's value should be saved during reloads/restarts. |
Boolean |
true |
scoreboard-title |
If not defined, this feature will remain disabled. The scoreboard feature only works for player type variables. Now supports color codes. |
String |
|
scoreboard-position |
Defines the position of the scoreboard display. Valid positions: sidebar , nameplate , or playerlist . |
String |
|
exp-bar |
Defines whether to display this variable on the experience bar. This does not modify the real experience. The feature only works for global and player variable types. |
Boolean |
false |
boss-bar |
If anything is defined here, the variable value will be displayed as the progress of a boss bar. This can be a boss bar title (string), or a BossBar configuration section (map). |
String or Section |
|
Option |
Description |
Type |
Default |
title |
Defines the title of the boss bar. |
String |
|
style |
Defines the boss bar style. |
String |
"solid" |
color |
Defines the boss bar color. |
String |
"purple" |
namespace-key |
Defines the namespaced key of this boss bar, with the default magicspells namespace. If this is unique, this boss bar will display separately. |
String |
"ms_variable" |
Meta variables help you access or modify special data regarding an entity, player, server, or other. An example is getting the server's player count, setting a player's compass target location, etc. A list of these variables can be found here.
global
- The
global
variable type has no defined owner. If you're modifying it through the ms variable modify
command, you can specify the <player>
parameter as -
or any string which isn't a valid player name.
- The Java variable type of this variable is Double.
Option |
Description |
Type |
Default |
default |
Defines the default variable value. |
Double |
0 |
min |
Defines min bounds. |
Double |
0 |
max |
Defines max bounds. |
Double |
Double.MAX_VALUE = (2-2-52)·21023
|
player
The player
variable type is bound to players. All other properties of this variable type are shared with the global
variable type.
globalstring
- The
globalstring
variable type is a global type too - with no defined owner. When using the ms variable modify
, use -
as the <player>
argument.
- The Java variable type of this variable is String.
- This variable type only has the
default-value
property.
playerstring
The playerstring
is player-bound. All other properties are shared with the globalstring
variable type.
distancetolocation
- This variable cannot be modified. It returns the distance calculated by the defined configuration.
- The Java variable type of this variable is String.
Option |
Description |
Type |
Default |
default |
Defines the default value to return if something fails. |
Double |
0 |
cross-world |
Defines whether the distance can be calculated across worlds. |
Boolean |
false |
target-location |
Define location to calculate distance from. Format: "world,x,y,z" . |
String |
"world,0,0,0" |
cross-world-distance-multiplier |
Defines cross-world multiplier. |
Double |
1 |
squareddistancetolocation
- The
squareddistancetolocation
variable type shares the same properties as the distancetolocation
variable type, but the result is distance squared.