Reading and writing variables
Connect Java to Skript local and global variables.
From Java
setVar("score", 42);
Object score = getVar("score");
setVar("_message", "Hello");
Object message = getVar("_message");
score is global; _message is local to the current event. Braces are optional: score and {score} are equivalent. %{_message}% is also accepted as a name.
From Skript
command /score:
trigger:
setVar "score" to 42
set {_value} to getVar "score"
send "%{_value}%" to sender
getVar %string% is an expression; setVar %string% to %objects% is an effect. Ordinary Skript syntax can access the same variables; the bridge does not create a separate variable database.
Value conversion
Strings, numbers and booleans pass through. Characters become strings and enums become their names. Supported server objects are retained; unknown scalar types may fall back to string representations.
See lists, arrays and maps for structured values. Collection reads return copies; changing a Java list does not automatically write it back to Skript.
Verify a write
Read a local variable within the same event, or a global variable in a later event, using ordinary Skript syntax. /jvdebug vars is a write snapshot, not a persistence guarantee or a complete synchronized view of storage.