Class RidePigChallenge

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

public class RidePigChallenge extends Object implements StoryBlitzChallenge, org.bukkit.event.Listener
A challenge where players must mount a pig with a saddle. The challenge is completed when a player successfully mounts any of the spawned pigs.
  • Constructor Details

    • RidePigChallenge

      public RidePigChallenge(List<Cuboid> spawnRegions)
      Constructs a RidePigChallenge using the provided 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 pigs at random locations.
      Specified by:
      start in interface StoryBlitzChallenge
      Parameters:
      players - List of players participating in the challenge
    • isCompleted

      public boolean isCompleted(org.bukkit.entity.Player player)
      Checks if the challenge is completed for a player.
      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)
      Cleans up the challenge by unregistering the event listener and removing all pigs.
      Specified by:
      cleanup in interface StoryBlitzChallenge
      Parameters:
      players - The players in the game.
    • onPlayerMountPig

      public void onPlayerMountPig(org.bukkit.event.player.PlayerInteractEntityEvent event)
      Handles the event when a player mounts a pig.
      Parameters:
      event - The PlayerInteractEntityEvent triggered when a player interacts with a pig