The Snake API
The Snake exposes Bukkit events for round lifecycle changes, player input, and score updates. Event classes live under dev.despical.snake.api.event and are dispatched on the primary server thread.
Available Events
Section titled “Available Events” SnakeEvent Base event type shared by every public Snake event.
GameStartEvent Fires when a waiting arena accepts its player and begins round initialization.
GameEndEvent Fires after a win or loss is detected and the arena enters its ending delay.
GameStateChangeEvent Reports every transition between inactive, waiting, starting, active, and ending states.
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.
StatisticChangeEvent Public statistic event class and its current dispatch limitation.
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.
- None of the current public event classes implements
Cancellable. GameStartEventfires before the board is snapshotted and before active movement starts.GameEndEventfires after the result is identified and its message is sent, but before the ending timer returns the player.NewScoreEventsees the already incremented score.