Indentation and the Skript parser

Why inline Java can need different formatting.

Two parsing stages

Skript reads .sk nodes and indentation first. SkJvm then reconstructs source and passes it to the Java compiler. An indentation error can therefore occur before Java compilation.

Lines ending in a colon

Skript treats lines ending in : as nested sections. This affects ordinary Java case and default labels. Do not assume every IDE-formatted fragment behaves identically inside .sk files.

For a classic switch, align labels without an additional indentation level relative to switch:

switch (value) {
case 1:
    sender.sendMessage("one");
    break;
default:
    sender.sendMessage("other");
}

When to use .jv

Move complex switches, text blocks and other awkward fragments into .jv files. Their contents are read as Java text without an intermediate Skript section tree. The file remains a method body, not a standalone class with a package declaration.

Reload the calling script after editing the module.

Type a query to search the guide.