Class BattleshipGame
java.lang.Object
com.storytimeproductions.stweaks.games.BattleshipGame
- All Implemented Interfaces:
Minigame, org.bukkit.event.Listener
-
Constructor Summary
ConstructorsConstructorDescriptionBattleshipGame(GameConfig config) Constructs a new Battleship game with the specified configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled after the game has been initialized.Gets the game configuration.List<org.bukkit.entity.Player> Gets the list of players currently in the game.voidjoin(org.bukkit.entity.Player player) Allows a player to join the game.voidleave(org.bukkit.entity.Player player) Allows a player to leave the game.voidCalled when the game is destroyed or stopped.voidonInit()Initializes the Battleship game.voidonInteract(org.bukkit.event.player.PlayerInteractEvent event) Handles player interactions to place or remove ship blocks on the board.voidremoveItems(org.bukkit.entity.Player player) Removes all game-related items from the player's inventory.voidrender()Renders the game state.booleanDetermines if the game should quit.voidupdate()Updates the game state.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Minigame
allowsConcurrentJoins, onCommand, onDamage, onDeath, onMove, onSneak, shouldTeleportOnExitModifier and TypeMethodDescriptiondefault booleanReturns true if players can join this game while it is already running.default voidonCommand(org.bukkit.event.player.PlayerCommandPreprocessEvent event) Called when a player in this game runs a command.default voidonDamage(org.bukkit.event.entity.EntityDamageByEntityEvent event) Called when a player in this game damages another player in this game.default voidonDeath(org.bukkit.event.entity.PlayerDeathEvent event) Called when a player in this game dies.default voidonMove(org.bukkit.event.player.PlayerMoveEvent event) Called when a player in this game moves.default voidonSneak(org.bukkit.event.player.PlayerToggleSneakEvent event) Called when a player in this game toggles sneak.default booleanReturns true if players should be teleported to the exit area when the game ends.
-
Constructor Details
-
BattleshipGame
Constructs a new Battleship game with the specified configuration.- Parameters:
config- the game configuration
-
-
Method Details
-
onInit
-
afterInit
-
update
-
render
-
onDestroy
-
join
-
leave
-
getPlayers
Gets the list of players currently in the game.- Specified by:
getPlayersin interfaceMinigame- Returns:
- a list of players in the minigame
-
getConfig
Gets the game configuration. -
shouldQuit
public boolean shouldQuit()Determines if the game should quit.- Specified by:
shouldQuitin interfaceMinigame- Returns:
- true if the minigame should quit, false otherwise
-
onInteract
public void onInteract(org.bukkit.event.player.PlayerInteractEvent event) Handles player interactions to place or remove ship blocks on the board.- Specified by:
onInteractin interfaceMinigame- Parameters:
event- the PlayerInteractEvent triggered by the player
-
removeItems
public void removeItems(org.bukkit.entity.Player player) Description copied from interface:MinigameRemoves all game-related items from the player's inventory.- Specified by:
removeItemsin interfaceMinigame- Parameters:
player- the player whose items will be removed
-