Class EmptyInventoryChallenge
java.lang.Object
com.storytimeproductions.models.stgames.challenges.EmptyInventoryChallenge
- All Implemented Interfaces:
StoryBlitzChallenge, org.bukkit.event.Listener
public class EmptyInventoryChallenge
extends Object
implements StoryBlitzChallenge, org.bukkit.event.Listener
Represents a challenge where players must empty their hotbar.
-
Constructor Summary
ConstructorsConstructorDescriptionEmptyInventoryChallenge(List<Cuboid> spawnRegions) Constructs a new EmptyInventoryChallenge. -
Method Summary
Modifier and TypeMethodDescriptionvoidCleans up the challenge by unregistering the event listener and clearing completed players.Returns the name of the challenge.booleanisCompleted(org.bukkit.entity.Player player) Handles the event when a player empties their hotbar.voidonPlayerDropItem(org.bukkit.event.player.PlayerDropItemEvent event) Prevents item drops and removes the item from the player's inventory instead.voidReturns the name of the challenge.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
-
EmptyInventoryChallenge
-
-
Method Details
-
getDescription
Returns the name of the challenge.- Specified by:
getDescriptionin interfaceStoryBlitzChallenge- Returns:
- The description of the challenge.
-
start
Returns the name of the challenge.- Specified by:
startin interfaceStoryBlitzChallenge- Parameters:
players- The players in the game.
-
isCompleted
public boolean isCompleted(org.bukkit.entity.Player player) Handles the event when a player empties their hotbar.- Specified by:
isCompletedin interfaceStoryBlitzChallenge- Parameters:
player- the player who emptied their hotbar- Returns:
- true if the player has completed the challenge, false otherwise.
-
onPlayerDropItem
public void onPlayerDropItem(org.bukkit.event.player.PlayerDropItemEvent event) Prevents item drops and removes the item from the player's inventory instead. -
cleanup
Cleans up the challenge by unregistering the event listener and clearing completed players.- Specified by:
cleanupin interfaceStoryBlitzChallenge- Parameters:
players- the list of players who participated in the challenge
-