Class KillPlayerChallenge
java.lang.Object
com.storytimeproductions.models.stgames.challenges.KillPlayerChallenge
- All Implemented Interfaces:
StoryBlitzChallenge, org.bukkit.event.Listener
public class KillPlayerChallenge
extends Object
implements StoryBlitzChallenge, org.bukkit.event.Listener
Represents a challenge where players must kill themselves by jumping off a tower. This class
implements the StoryBlitzChallenge interface and handles player deaths and damage events to
determine if the challenge is completed.
-
Constructor Summary
ConstructorsConstructorDescriptionKillPlayerChallenge(List<Cuboid> spawnRegions) Constructor for the KillPlayerChallenge. -
Method Summary
Modifier and TypeMethodDescriptionvoidCleans up the challenge by unregistering the event listener and removing the tower.Returns the description of the challenge.booleanisCompleted(org.bukkit.entity.Player player) Checks if the challenge is completed by the player.voidonPlayerDamage(org.bukkit.event.entity.EntityDamageEvent event) Handles player damage events to check if the player has killed themselves.voidonPlayerDeath(org.bukkit.event.entity.PlayerDeathEvent event) Handles player death events to check if the player has killed themselves.voidStarts the challenge by teleporting players to the top of the tower 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
-
KillPlayerChallenge
-
-
Method Details
-
getDescription
Returns the description of the challenge.- Specified by:
getDescriptionin interfaceStoryBlitzChallenge- Returns:
- the description of the challenge
-
start
Starts the challenge by teleporting players to the top of the tower 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 challenge is completed by the player.- Specified by:
isCompletedin interfaceStoryBlitzChallenge- Parameters:
player- the player to check- Returns:
- true if the player has completed the challenge, false otherwise
-
cleanup
Cleans up the challenge by unregistering the event listener and removing the tower.- Specified by:
cleanupin interfaceStoryBlitzChallenge- Parameters:
players- the list of players who participated in the challenge
-
onPlayerDeath
public void onPlayerDeath(org.bukkit.event.entity.PlayerDeathEvent event) Handles player death events to check if the player has killed themselves.- Parameters:
event- the PlayerDeathEvent triggered when a player dies
-
onPlayerDamage
public void onPlayerDamage(org.bukkit.event.entity.EntityDamageEvent event) Handles player damage events to check if the player has killed themselves.- Parameters:
event- the EntityDamageEvent triggered when a player takes damage
-