Class GymGame
java.lang.Object
com.storytimeproductions.stweaks.games.GymGame
- All Implemented Interfaces:
Minigame, org.bukkit.event.Listener
Represents a gym-themed minigame where players can interact with punching bags, treadmills, and
trampolines to earn time tickets.
This class implements the Minigame interface and handles game initialization, player interactions, and game logic.
-
Constructor Summary
ConstructorsConstructorDescriptionGymGame(GameConfig config) Constructs a new GymGame with the specified configuration and plugin. -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled after the game has been initialized.booleanReturns true if players can join this game while it is already running.Returns the game configuration.List<org.bukkit.entity.Player> Returns the list of players currently in the game.voidjoin(org.bukkit.entity.Player player) Adds the player to the game.voidleave(org.bukkit.entity.Player player) Removes the player from the game.voidDestroys the game, unregistering all events and cleaning up resources.voidonInit()Initializes the minigame.voidonInteract(org.bukkit.event.player.PlayerInteractEvent event) Handles player interactions with punching bags.voidonMove(org.bukkit.event.player.PlayerMoveEvent event) Handles player movement to detect treadmill and trampoline interactions.voidonSneak(org.bukkit.event.player.PlayerToggleSneakEvent event) Handles player crouch (sneak) actions to detect squat interactions.voidremoveItems(org.bukkit.entity.Player player) Removes specific items from the player's inventory as required by the minigame.voidrender()Renders any visual elements or updates required by the minigame.voidResets all gym station counts and displays back to the goal value.booleanDetermines whether the game should end or quit.booleanReturns true if players should be teleported to the exit area when the game ends.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
onCommand, onDamage, onDeathModifier and TypeMethodDescriptiondefault 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.
-
Constructor Details
-
GymGame
Constructs a new GymGame with the specified configuration and plugin.- Parameters:
config- the game configuration
-
-
Method Details
-
onInit
-
join
-
leave
-
getPlayers
Returns the list of players currently in the game.- Specified by:
getPlayersin interfaceMinigame- Returns:
- a list of players
-
getConfig
Returns the game configuration. -
onDestroy
-
allowsConcurrentJoins
public boolean allowsConcurrentJoins()Description copied from interface:MinigameReturns 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:
allowsConcurrentJoinsin interfaceMinigame
-
shouldTeleportOnExit
public boolean shouldTeleportOnExit()Description copied from interface:MinigameReturns 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:
shouldTeleportOnExitin interfaceMinigame
-
onInteract
public void onInteract(org.bukkit.event.player.PlayerInteractEvent event) Handles player interactions with punching bags.- Specified by:
onInteractin interfaceMinigame- Parameters:
event- the PlayerInteractEvent triggered by a player
-
onMove
-
resetAllCounts
public void resetAllCounts()Resets all gym station counts and displays back to the goal value. -
afterInit
-
update
-
render
-
shouldQuit
public boolean shouldQuit()Determines whether the game should end or quit.- Specified by:
shouldQuitin interfaceMinigame- Returns:
- true if the game should quit, false otherwise
-
removeItems
public void removeItems(org.bukkit.entity.Player player) Removes specific items from the player's inventory as required by the minigame.- Specified by:
removeItemsin interfaceMinigame- Parameters:
player- the player from whom to remove items
-
onSneak
-