The Snake API
The Snake exposes Bukkit events for round lifecycle changes, player input, score updates, and mutable statistic changes. Event classes live under dev.despical.snake.api.event and are dispatched synchronously on the primary server thread.
Available Events
Section titled “Available Events” SnakeEvent Base event type shared by every public Snake event.
GameStartEvent Fires after the board, first segment, direction, and apple are prepared.
GameEndEvent Fires after a win or loss is detected and the arena enters its ending delay.
GameStateChangeEvent Reports and can cancel every requested lifecycle transition.
KeyPressedEvent Reports the current W, A, S, D, or no-input state from Paper player input.
NewScoreEvent Fires after an apple is collected and the round score increases.
PlayerStatisticChangeEvent Inspect, replace, or cancel a player statistic update before storage.
Register a Listener
Section titled “Register a Listener”public final class SnakeIntegration extends JavaPlugin implements Listener {
@Override public void onEnable() { getServer().getPluginManager().registerEvents(this, this); }}Add the dependency so your plugin loads after Snake:
softdepend: - SnakeUse depend instead if your plugin cannot function without The Snake.
Event Guarantees
Section titled “Event Guarantees”- Events are synchronous Bukkit events.
GameStateChangeEventandPlayerStatisticChangeEventimplementCancellable; the other concrete events are informational.GameStartEventfires after the board, first segment, initial direction, and first apple are prepared.GameEndEventfires after the result is identified and its message is sent, but before the ending timer returns the player.NewScoreEventsees the already incremented score.
Event Discovery
Section titled “Event Discovery”EventType enumerates the six registered event types. EventRegistry.getRegisteredTypes() returns an unmodifiable set, while getEventClass(type) and matches(type, event) support generic integration and diagnostic tooling. Normal Bukkit listeners should still register against concrete event classes.