Class RouletteGame

java.lang.Object
com.storytimeproductions.stweaks.games.RouletteGame
All Implemented Interfaces:
Minigame

public class RouletteGame extends Object implements Minigame
Roulette game with three tables, each represented by a wall block. Players left-click to confirm, starting a 5s countdown hologram above the wall. Other players can right-click to join the table, which interrupts the countdown. Only main hand interactions are allowed. The table is not picked randomly; the table is determined by the block.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new RouletteGame with the specified configuration.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called after the minigame has been initialized.
    boolean
    Returns true if players can join this game while it is already running.
    Gets the minigame configuration.
    List<org.bukkit.entity.Player>
    Gets the list of players currently in the minigame.
    void
    join(org.bukkit.entity.Player player)
    Initializes the hologram lines for each slot at each table.
    void
    leave(org.bukkit.entity.Player player)
    Removes the specified player from the game and updates holograms.
    void
    Initializes the hologram lines for each slot at each table.
    void
    Initializes the minigame.
    void
    onInteract(org.bukkit.event.player.PlayerInteractEvent event)
    Handles player interaction with a table block.
    void
    removeItems(org.bukkit.entity.Player player)
    Removes all game-related items from the player's inventory.
    void
    Renders the game state.
    boolean
    Determines if the minigame should quit.
    boolean
    Returns true if players should be teleported to the exit area when the game ends.
    void
    Initializes the hologram lines for each slot at each table.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface Minigame

    onCommand, onDamage, onDeath, onMove, onSneak
    Modifier and Type
    Method
    Description
    default void
    onCommand(org.bukkit.event.player.PlayerCommandPreprocessEvent event)
    Called when a player in this game runs a command.
    default void
    onDamage(org.bukkit.event.entity.EntityDamageByEntityEvent event)
    Called when a player in this game damages another player in this game.
    default void
    onDeath(org.bukkit.event.entity.PlayerDeathEvent event)
    Called when a player in this game dies.
    default void
    onMove(org.bukkit.event.player.PlayerMoveEvent event)
    Called when a player in this game moves.
    default void
    onSneak(org.bukkit.event.player.PlayerToggleSneakEvent event)
    Called when a player in this game toggles sneak.
  • Constructor Details

    • RouletteGame

      public RouletteGame(GameConfig config)
      Constructs a new RouletteGame with the specified configuration.
      Parameters:
      config - the game configuration containing properties and settings
  • Method Details

    • onInit

      public void onInit()
      Description copied from interface: Minigame
      Initializes the minigame.
      Specified by:
      onInit in interface Minigame
    • afterInit

      public void afterInit()
      Description copied from interface: Minigame
      Called after the minigame has been initialized.
      Specified by:
      afterInit in interface Minigame
    • update

      public void update()
      Initializes the hologram lines for each slot at each table. This is called when the game is initialized or reset.
      Specified by:
      update in interface Minigame
    • render

      public void render()
      Renders the game state. This could be used for action bars, holograms,
      Specified by:
      render in interface Minigame
    • onDestroy

      public void onDestroy()
      Initializes the hologram lines for each slot at each table. This is called when the game is initialized or reset.
      Specified by:
      onDestroy in interface Minigame
    • join

      public void join(org.bukkit.entity.Player player)
      Initializes the hologram lines for each slot at each table.
      Specified by:
      join in interface Minigame
      Parameters:
      player - the player to initialize holograms for
    • leave

      public void leave(org.bukkit.entity.Player player)
      Removes the specified player from the game and updates holograms.
      Specified by:
      leave in interface Minigame
      Parameters:
      player - the player to remove
    • getPlayers

      public List<org.bukkit.entity.Player> getPlayers()
      Description copied from interface: Minigame
      Gets the list of players currently in the minigame.
      Specified by:
      getPlayers in interface Minigame
      Returns:
      a list of players in the minigame
    • getConfig

      public GameConfig getConfig()
      Description copied from interface: Minigame
      Gets the minigame configuration.
      Specified by:
      getConfig in interface Minigame
      Returns:
      the minigame configuration
    • shouldQuit

      public boolean shouldQuit()
      Description copied from interface: Minigame
      Determines if the minigame should quit.
      Specified by:
      shouldQuit in interface Minigame
      Returns:
      true if the minigame should quit, false otherwise
    • removeItems

      public void removeItems(org.bukkit.entity.Player player)
      Description copied from interface: Minigame
      Removes all game-related items from the player's inventory.
      Specified by:
      removeItems in interface Minigame
      Parameters:
      player - the player whose items will be removed
    • allowsConcurrentJoins

      public boolean allowsConcurrentJoins()
      Description copied from interface: Minigame
      Returns true if players can join this game while it is already running. Defaults to false (players must wait for the previous round to finish).
      Specified by:
      allowsConcurrentJoins in interface Minigame
    • shouldTeleportOnExit

      public boolean shouldTeleportOnExit()
      Description copied from interface: Minigame
      Returns true if players should be teleported to the exit area when the game ends. Defaults to true; override to false for games that manage their own exit flow.
      Specified by:
      shouldTeleportOnExit in interface Minigame
    • onInteract

      public void onInteract(org.bukkit.event.player.PlayerInteractEvent event)
      Handles player interaction with a table block. Only main hand interactions are allowed.
      Specified by:
      onInteract in interface Minigame