Imports and event context

Available types, sender resolution and event bindings.

Predeclared imports

The wrapper imports org.bukkit.*, org.bukkit.block.*, org.bukkit.command.*, org.bukkit.entity.*, org.bukkit.event.*, org.bukkit.event.player.*, org.bukkit.inventory.*, org.bukkit.util.*, java.util.*, and java.util.function.*.

Custom import and package declarations cannot appear in a block or .jv file because the code becomes a method body. Use fully qualified names, such as org.bukkit.event.entity.EntityDamageEvent. Disambiguate Vector as org.bukkit.util.Vector or java.util.Vector.

Event bindings

Event Context values
Any available event event
PlayerEvent player
EntityDamageEvent damage, victim
EntityDamageByEntityEvent Also attacker
Object victim = context.get("victim");
if (victim instanceof Player player) {
    player.sendMessage("Damage received: " + context.get("damage"));
}

Sender resolution

sender comes from player events, server commands and Skript command events. Otherwise it falls back to the console. Check its type before casting to Player when console execution is possible.

Background compilation does not make Bukkit APIs thread-safe. Java executes on the original event thread; asynchronous events retain the restrictions of their APIs.

Type a query to search the guide.