Skip to main content

đŸ”ĸ Global Variables

Quick Start​

A global variable is a reusable text snippet you define once and reference anywhere — item names, lore, messages, GUIs, holograms. Change it in one place, and every reference updates.

Step 1 — Define a variable under global_variables:

global_variables:
rare_tag: "<!i><bold><#FF8C00>[RARE]</#FF8C00></bold>"

Step 2 — Reference it with the <global:id> tag:

items:
default:topaz_sword:
material: diamond_sword
data:
item_name: "<global:rare_tag> Topaz Sword"

That's it. The <global:rare_tag> tag gets replaced with the variable's content.


Configuration​

Global variables live under the global_variables section. Each entry is a key-value pair:

global_variables:
rare_tag: "<!i><bold><#FF8C00>[RARE]</#FF8C00></bold>"
vip_prefix: "<!i><gradient:#FFD700:#FFA500>[VIP]</gradient>"
coin_icon: "<!shadow><image:default:coins>"
FieldDescription
KeyThe variable's ID, used in <global:key>.
ValueThe MiniMessage content to substitute. Fully supports tags, colors, images, and other variables.

Using Variables​

Basic Usage​

<global:id>
item_name: "<global:rare_tag> Topaz Sword"

With Arguments​

Variables support indexed arguments — <arg:0>, <arg:1>, etc. — that you fill in at the call site:

global_variables:
owner_item: "<!i><#FF8C00><arg:0>'s <arg:1>"
# Pass arguments after the ID, separated by colons
item_name: "<global:owner_item:'<arg:player.name>':'<lang:item.default.topaz_rod>'>"

Here <arg:0> becomes the player's name and <arg:1> becomes the translated item name. Arguments are themselves parsed as MiniMessage, so you can nest tags inside them.

In Other Plugins​

Global variables work at the packet level, so they're available in any plugin that sends text through the packets CraftEngine intercepts:

# A hologram config in another plugin
line: "<global:coin_icon> My coins: %vault_eco_balance%"
tip

Packet-level replacement requires the relevant interceptor to be enabled in config.yml → network.intercept-packets.