Class PunchPigChallenge

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

public class PunchPigChallenge extends Object implements StoryBlitzChallenge, org.bukkit.event.Listener
A challenge where players must punch five named pigs. Each player must punch all five pigs once to complete the challenge. All pigs are despawned on cleanup.
  • Constructor Details

    • PunchPigChallenge

      public PunchPigChallenge(List<Cuboid> spawnRegions)
      Constructs a PunchPigChallenge using spawn regions.
      Parameters:
      spawnRegions - List of Cuboid regions to spawn pigs in
  • Method Details

    • getDescription

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

      public void start(List<org.bukkit.entity.Player> players)
      Starts the challenge by spawning five named pigs and registering the event listener.
      Specified by:
      start in interface StoryBlitzChallenge
      Parameters:
      players - The list of players participating in the challenge
    • isCompleted

      public boolean isCompleted(org.bukkit.entity.Player player)
      Checks if the player has punched all five pigs.
      Specified by:
      isCompleted in interface StoryBlitzChallenge
      Parameters:
      player - The player to check
      Returns:
      true if the player has punched all pigs, false otherwise
    • cleanup

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

      public void onPigPunch(org.bukkit.event.entity.EntityDamageByEntityEvent event)
      Handles pig punch events. Tracks which pigs each player has punched and prevents pig death.
      Parameters:
      event - The EntityDamageByEntityEvent triggered when a player punches a pig