Lists and nested maps

Automatic conversion between collections and variable trees.

Lists and arrays

setVar("_items::*", List.of("sword", "shield"));
List<?> items = getList("_items");

Collections and arrays become one-based Skript indices. getList accepts names with or without ::*. Missing lists return an empty collection.

Nested maps

setVar("profile::*", Map.of(
    "name", "Alex",
    "stats", Map.of("wins", 12)
));
Map<String, Object> profile = getMap("profile");

This creates profile::name and profile::stats::wins. Reads return a detached structure.

Indices and result shapes

getVar("name::*") returns a List for dense 1..N indices, and a Map for named or sparse indices. getMap preserves string keys at the top level; nested dense branches may become lists. getList rejects sparse trees; use getMap instead.

Tree limits

  • Keys become strings; path collisions are rejected.
  • Empty keys, ::, *, and braces in keys are rejected.
  • $value is reserved for a scalar on a nested node that also has children.
  • Cycles, excessive depth and excessive leaf counts are rejected before replacing the tree.
  • Empty collections produce no Skript indices and read back as an empty list or map.

Mutating a returned Java structure does not synchronize automatically. Pass the updated structure back to setVar.

Type a query to search the guide.