Skip to content

GameStartEvent

The GameStartEvent is triggered when a Santa Says game has finished all its internal setup and is about to begin. At this point, players have been teleported, their scores have been reset, and the tasks have been prepared.


  • Package: io.greenmc.santasays.api.event.game
  • Parent Class: GameEvent
  • Cancellable: No

This event inherits all utility methods from the base GameEvent class, allowing you to access the Game instance and all its managers.

MethodReturn TypeDescription
getGame()GameReturns the active Game instance that is starting.
getArena()ArenaShortcut to return the Arena associated with the starting game.

When this event is called:

  • Player Setup: Players are already in their designated starting positions.
  • Score Initialization: The ScoreRegistry has been cleared and prepared for the new session.
  • Ready State: The arena is locked and no longer accepting join attempts.

This example demonstrates how to trigger a global sound effect or a custom message to the entire server when a game officially starts.

import io.greenmc.santasays.api.event.game.GameStartEvent;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class GlobalAnnouncementListener implements Listener {
@EventHandler
public void onGameStart(GameStartEvent event) {
String arenaName = event.getArena().getName();
// Notify the whole server
Bukkit.broadcastMessage("§6[Santa Says] §eA new game has started in arena: §f" + arenaName);
// Play a start sound for everyone in the game
for (Player player : event.getGame().getPlayers()) {
player.playSound(player.getLocation(), Sound.ENTITY_WITHER_SPAWN, 1.0f, 1.0f);
}
}
}