Class SnowballChallenge

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

public class SnowballChallenge extends Object implements StoryBlitzChallenge, org.bukkit.event.Listener
A challenge where players must hit another player with a snowball. Players are given a stack of snowballs. When a player hits another player with a snowball, they are marked as completed and their snowballs are removed. On cleanup, all snowballs on the ground and in inventories are removed.
  • Constructor Details

    • SnowballChallenge

      public SnowballChallenge(List<Cuboid> spawnRegions)
      Constructs a SnowballChallenge using the provided spawn regions.
      Parameters:
      spawnRegions - List of Cuboid regions to spawn snowballs in
  • Method Details

    • getDescription

      public String getDescription()
      Description copied from interface: StoryBlitzChallenge
      Returns the description of the challenge, which is shown to players.
      Specified by:
      getDescription in interface StoryBlitzChallenge
      Returns:
      The description of the challenge.
    • start

      public void start(List<org.bukkit.entity.Player> players)
      Description copied from interface: StoryBlitzChallenge
      Called when the challenge starts for the given players.
      Specified by:
      start in interface StoryBlitzChallenge
      Parameters:
      players - The players in the game.
    • isCompleted

      public boolean isCompleted(org.bukkit.entity.Player player)
      Description copied from interface: StoryBlitzChallenge
      Checks if the player has completed the challenge.
      Specified by:
      isCompleted in interface StoryBlitzChallenge
      Parameters:
      player - The player to check.
      Returns:
      true if the player has completed the challenge, false otherwise.
    • cleanup

      public void cleanup(List<org.bukkit.entity.Player> players)
      Description copied from interface: StoryBlitzChallenge
      Called when the challenge ends (cleanup).
      Specified by:
      cleanup in interface StoryBlitzChallenge
      Parameters:
      players - The players in the game.
    • onEntityDamageByEntity

      public void onEntityDamageByEntity(org.bukkit.event.entity.EntityDamageByEntityEvent event)
      Handles when a player is hit by a snowball thrown by another player.