Class ParkourGame

java.lang.Object
com.storytimeproductions.stweaks.games.ParkourGame
All Implemented Interfaces:
Minigame, org.bukkit.event.Listener

public class ParkourGame extends Object implements Minigame, org.bukkit.event.Listener
ParkourGame: Players are teleported to the start area. If they fall to the floor level, they are out. If they right-click the win block, they win and get 5 time tickets.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a ParkourGame instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called after the minigame has been initialized.
    boolean
    If a player in the game lands on the floor level, remove them from the game.
    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)
    Adds the specified player to the minigame.
    void
    leave(org.bukkit.entity.Player player)
    Removes the specified player from the minigame.
    void
    onCommand(org.bukkit.event.player.PlayerCommandPreprocessEvent event)
    Prevents players from using TPA commands while in the parkour game.
    void
    Cleans up resources when the minigame is destroyed.
    void
    Initializes the minigame.
    void
    onInteract(org.bukkit.event.player.PlayerInteractEvent event)
    If a player in the game right-clicks the win block, reward and remove them.
    void
    onMove(org.bukkit.event.player.PlayerMoveEvent event)
    Called when a player in this game moves.
    void
    removeItems(org.bukkit.entity.Player player)
    Removes all game-related items from the player's inventory.
    void
    Renders the minigame 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
    Updates the minigame state.

    Methods inherited from class Object

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

    Methods inherited from interface Minigame

    onDamage, onDeath, onSneak
    Modifier and Type
    Method
    Description
    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
    onSneak(org.bukkit.event.player.PlayerToggleSneakEvent event)
    Called when a player in this game toggles sneak.
  • Constructor Details

    • ParkourGame

      public ParkourGame(GameConfig config)
      Constructs a ParkourGame instance.
      Parameters:
      config - The game configuration.
  • 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()
      Description copied from interface: Minigame
      Updates the minigame state.
      Specified by:
      update in interface Minigame
    • render

      public void render()
      Description copied from interface: Minigame
      Renders the minigame state.
      Specified by:
      render in interface Minigame
    • join

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

      public void leave(org.bukkit.entity.Player player)
      Description copied from interface: Minigame
      Removes the specified player from the minigame.
      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()
      If a player in the game lands on the floor level, remove them from the game.
      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
    • onMove

      public void onMove(org.bukkit.event.player.PlayerMoveEvent event)
      Description copied from interface: Minigame
      Called when a player in this game moves.
      Specified by:
      onMove in interface Minigame
    • onInteract

      public void onInteract(org.bukkit.event.player.PlayerInteractEvent event)
      If a player in the game right-clicks the win block, reward and remove them.
      Specified by:
      onInteract in interface Minigame
    • onCommand

      public void onCommand(org.bukkit.event.player.PlayerCommandPreprocessEvent event)
      Prevents players from using TPA commands while in the parkour game.

      This is to ensure that players cannot teleport out of the parkour area during gameplay.

      Specified by:
      onCommand in interface Minigame
    • onDestroy

      public void onDestroy()
      Description copied from interface: Minigame
      Cleans up resources when the minigame is destroyed.
      Specified by:
      onDestroy in interface Minigame