Interface Minigame
- All Known Implementing Classes:
BattleshipGame, BlockBreakGame, BlockPartyGame, BombermanGame, ColorSplatGame, DodgeballGame, FishSlapGame, GymGame, HungryHungryHooksGame, KothTagGame, ParkourGame, RouletteGame, SpleefGame, StoryBlitz
public interface Minigame
Represents a minigame that can be played within the game environment. Each minigame has its own
lifecycle methods and player management.
-
Method Summary
Modifier and TypeMethodDescriptionvoidCalled after the minigame has been initialized.default booleanReturns 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.voidjoin(org.bukkit.entity.Player player) Adds the specified player to the minigame.voidleave(org.bukkit.entity.Player player) Removes the specified player from the minigame.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.voidCleans up resources when the minigame is destroyed.voidonInit()Initializes the minigame.default voidonInteract(org.bukkit.event.player.PlayerInteractEvent event) Called when a player in this game interacts with a block or air.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.voidremoveItems(org.bukkit.entity.Player player) Removes all game-related items from the player's inventory.voidrender()Renders the minigame state.booleanDetermines if the minigame should quit.default booleanReturns true if players should be teleported to the exit area when the game ends.voidupdate()Updates the minigame state.
-
Method Details
-
onInit
void onInit()Initializes the minigame. -
afterInit
void afterInit()Called after the minigame has been initialized. -
update
void update()Updates the minigame state. -
render
void render()Renders the minigame state. -
onDestroy
void onDestroy()Cleans up resources when the minigame is destroyed. -
shouldQuit
boolean shouldQuit()Determines if the minigame should quit.- Returns:
- true if the minigame should quit, false otherwise
-
join
void join(org.bukkit.entity.Player player) Adds the specified player to the minigame.- Parameters:
player- the player to add
-
leave
void leave(org.bukkit.entity.Player player) Removes the specified player from the minigame.- Parameters:
player- the player to remove
-
getPlayers
List<org.bukkit.entity.Player> getPlayers()Gets the list of players currently in the minigame.- Returns:
- a list of players in the minigame
-
getConfig
-
removeItems
void removeItems(org.bukkit.entity.Player player) Removes all game-related items from the player's inventory.- Parameters:
player- the player whose items will be removed
-
onInteract
default void onInteract(org.bukkit.event.player.PlayerInteractEvent event) Called when a player in this game interacts with a block or air. -
onMove
default void onMove(org.bukkit.event.player.PlayerMoveEvent event) Called when a player in this game moves. -
onDeath
default void onDeath(org.bukkit.event.entity.PlayerDeathEvent event) Called when a player in this game dies. -
onDamage
default void onDamage(org.bukkit.event.entity.EntityDamageByEntityEvent event) Called when a player in this game damages another player in this game. -
onSneak
default void onSneak(org.bukkit.event.player.PlayerToggleSneakEvent event) Called when a player in this game toggles sneak. -
onCommand
default void onCommand(org.bukkit.event.player.PlayerCommandPreprocessEvent event) Called when a player in this game runs a command. -
allowsConcurrentJoins
default boolean allowsConcurrentJoins()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). -
shouldTeleportOnExit
default boolean shouldTeleportOnExit()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.
-