Class EmptyInventoryChallenge

java.lang.Object
com.storytimeproductions.models.stgames.challenges.EmptyInventoryChallenge
All Implemented Interfaces:
StoryBlitzChallenge, org.bukkit.event.Listener

public class EmptyInventoryChallenge extends Object implements StoryBlitzChallenge, org.bukkit.event.Listener
Represents a challenge where players must empty their hotbar.
  • Constructor Details

    • EmptyInventoryChallenge

      public EmptyInventoryChallenge(List<Cuboid> spawnRegions)
      Constructs a new EmptyInventoryChallenge.
  • Method Details

    • getDescription

      public String getDescription()
      Returns the name of the challenge.
      Specified by:
      getDescription in interface StoryBlitzChallenge
      Returns:
      The description of the challenge.
    • start

      public void start(List<org.bukkit.entity.Player> players)
      Returns the name of the challenge.
      Specified by:
      start in interface StoryBlitzChallenge
      Parameters:
      players - The players in the game.
    • isCompleted

      public boolean isCompleted(org.bukkit.entity.Player player)
      Handles the event when a player empties their hotbar.
      Specified by:
      isCompleted in interface StoryBlitzChallenge
      Parameters:
      player - the player who emptied their hotbar
      Returns:
      true if the player has completed the challenge, false otherwise.
    • onPlayerDropItem

      public void onPlayerDropItem(org.bukkit.event.player.PlayerDropItemEvent event)
      Prevents item drops and removes the item from the player's inventory instead.
    • cleanup

      public void cleanup(List<org.bukkit.entity.Player> players)
      Cleans up the challenge by unregistering the event listener and clearing completed players.
      Specified by:
      cleanup in interface StoryBlitzChallenge
      Parameters:
      players - the list of players who participated in the challenge