Class DodgeballGame

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

public class DodgeballGame extends Object implements Minigame
Represents a Dodgeball game where players are split into two teams and can throw rockets at each other. Implements the Minigame interface for game lifecycle management.
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    void
    Called after the game has been initialized.
    Gets the game configuration.
    List<org.bukkit.entity.Player>
    Gets the list of players currently in the game.
    void
    join(org.bukkit.entity.Player player)
    Adds the specified player to the game.
    void
    leave(org.bukkit.entity.Player player)
    Removes the specified player from the game.
    void
    onDeath(org.bukkit.event.entity.PlayerDeathEvent event)
    Handles player death events to announce which team the player belonged to.
    void
    Cleans up resources when the game is destroyed.
    void
    Initializes the Battleship game.
    void
    removeItems(org.bukkit.entity.Player player)
    Removes any items related to the game from the player's inventory.
    void
    Renders the game state.
    boolean
    Determines if the game should quit.
    void
    Updates the game state.

    Methods inherited from class Object

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

    Methods inherited from interface Minigame

    allowsConcurrentJoins, onCommand, onDamage, onInteract, onMove, onSneak, shouldTeleportOnExit
    Modifier and Type
    Method
    Description
    default boolean
    Returns true if players can join this game while it is already running.
    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
    onInteract(org.bukkit.event.player.PlayerInteractEvent event)
    Called when a player in this game interacts with a block or air.
    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.
    default boolean
    Returns true if players should be teleported to the exit area when the game ends.
  • Constructor Details

    • DodgeballGame

      public DodgeballGame(GameConfig config)
      Constructs a new Dodgeball game with the specified configuration.
      Parameters:
      config - the game configuration
  • Method Details

    • onInit

      public void onInit()
      Initializes the Battleship game.
      Specified by:
      onInit in interface Minigame
    • afterInit

      public void afterInit()
      Called after the game has been initialized.
      Specified by:
      afterInit in interface Minigame
    • onDeath

      public void onDeath(org.bukkit.event.entity.PlayerDeathEvent event)
      Handles player death events to announce which team the player belonged to.
      Specified by:
      onDeath in interface Minigame
      Parameters:
      event - the PlayerDeathEvent
    • update

      public void update()
      Updates the game state.
      Specified by:
      update in interface Minigame
    • render

      public void render()
      Renders the game state.
      Specified by:
      render in interface Minigame
    • onDestroy

      public void onDestroy()
      Cleans up resources when the game is destroyed.
      Specified by:
      onDestroy in interface Minigame
    • join

      public void join(org.bukkit.entity.Player player)
      Adds the specified player to the game.
      Specified by:
      join in interface Minigame
      Parameters:
      player - the player to add
    • leave

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

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

      public GameConfig getConfig()
      Gets the game configuration.
      Specified by:
      getConfig in interface Minigame
      Returns:
      the game configuration
    • shouldQuit

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

      public void removeItems(org.bukkit.entity.Player player)
      Removes any items related to the game from the player's inventory.
      Specified by:
      removeItems in interface Minigame
      Parameters:
      player - the player whose items should be removed