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 Summary
ConstructorsConstructorDescriptionPunchPigChallenge(List<Cuboid> spawnRegions) Constructs a PunchPigChallenge using spawn regions. -
Method Summary
Modifier and TypeMethodDescriptionvoidCleans up the challenge by despawning all pigs and unregistering the event listener.Gets the description of the challenge.booleanisCompleted(org.bukkit.entity.Player player) Checks if the player has punched all five pigs.voidonPigPunch(org.bukkit.event.entity.EntityDamageByEntityEvent event) Handles pig punch events.voidStarts the challenge by spawning five named pigs and registering the event listener.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface StoryBlitzChallenge
getDescriptionWithGoobModifier and TypeMethodDescriptiondefault StringgetDescriptionWithGoob(String normalDescription) Returns a description with a chance to include "goob" for fun.
-
Constructor Details
-
PunchPigChallenge
-
-
Method Details
-
getDescription
Gets the description of the challenge.- Specified by:
getDescriptionin interfaceStoryBlitzChallenge- Returns:
- Challenge description
-
start
Starts the challenge by spawning five named pigs and registering the event listener.- Specified by:
startin interfaceStoryBlitzChallenge- 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:
isCompletedin interfaceStoryBlitzChallenge- Parameters:
player- The player to check- Returns:
- true if the player has punched all pigs, false otherwise
-
cleanup
Cleans up the challenge by despawning all pigs and unregistering the event listener.- Specified by:
cleanupin interfaceStoryBlitzChallenge- 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
-