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

    Constructors
    Constructor
    Description
    Constructor for the KillPlayerChallenge.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    cleanup(List<org.bukkit.entity.Player> players)
    Cleans up the challenge by unregistering the event listener and removing the tower.
    Returns the description of the challenge.
    boolean
    isCompleted(org.bukkit.entity.Player player)
    Checks if the challenge is completed by the player.
    void
    onPlayerDamage(org.bukkit.event.entity.EntityDamageEvent event)
    Handles player damage events to check if the player has killed themselves.
    void
    onPlayerDeath(org.bukkit.event.entity.PlayerDeathEvent event)
    Handles player death events to check if the player has killed themselves.
    void
    start(List<org.bukkit.entity.Player> players)
    Starts 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, wait

    Methods inherited from interface StoryBlitzChallenge

    getDescriptionWithGoob
    Modifier and Type
    Method
    Description
    default String
    getDescriptionWithGoob(String normalDescription)
    Returns a description with a chance to include "goob" for fun.
  • Constructor Details

    • KillPlayerChallenge

      public KillPlayerChallenge(List<Cuboid> spawnRegions)
      Constructor for the KillPlayerChallenge.
      Parameters:
      spawnRegions - the spawnRegions from which the tower will be spawned in.
  • Method Details

    • getDescription

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

      public void start(List<org.bukkit.entity.Player> players)
      Starts the challenge by teleporting players to the top of the tower 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 challenge is completed by the 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 the tower.
      Specified by:
      cleanup in interface StoryBlitzChallenge
      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