Class PlayerKeepsInventoryEvent
java.lang.Object
org.bukkit.event.Event
com.palmergames.bukkit.towny.event.player.PlayerKeepsInventoryEvent
- All Implemented Interfaces:
org.bukkit.event.Cancellable
public class PlayerKeepsInventoryEvent
extends org.bukkit.event.Event
implements org.bukkit.event.Cancellable
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result
-
Constructor Summary
ConstructorDescriptionPlayerKeepsInventoryEvent
(org.bukkit.event.entity.PlayerDeathEvent event) An event thrown after a PlayerDeathEvent at HIGHEST priority.PlayerKeepsInventoryEvent
(org.bukkit.event.entity.PlayerDeathEvent event, boolean keepInventory) An event thrown after a PlayerDeathEvent at HIGHEST priority. -
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.event.HandlerList
org.bukkit.event.HandlerList
@Nullable Resident
org.bukkit.Location
org.bukkit.entity.Player
org.bukkit.event.entity.PlayerDeathEvent
@Nullable Town
boolean
When true, players will not keep their inventory.boolean
void
setCancelled
(boolean cancel) Set to true in order to prevent Towny from keeping the inventory.Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
Constructor Details
-
PlayerKeepsInventoryEvent
public PlayerKeepsInventoryEvent(org.bukkit.event.entity.PlayerDeathEvent event) An event thrown after a PlayerDeathEvent at HIGHEST priority. Thrown when Towny would opt to keep someone's inventory and clear the drops.- Parameters:
event
- PlayerDeathEvent
-
PlayerKeepsInventoryEvent
public PlayerKeepsInventoryEvent(org.bukkit.event.entity.PlayerDeathEvent event, boolean keepInventory) An event thrown after a PlayerDeathEvent at HIGHEST priority. Thrown when Towny would opt to keep someone's inventory and clear the drops.- Parameters:
event
- PlayerDeathEventkeepInventory
- Default state of the event.
-
-
Method Details
-
isCancelled
public boolean isCancelled()When true, players will not keep their inventory.- Specified by:
isCancelled
in interfaceorg.bukkit.event.Cancellable
-
setCancelled
public void setCancelled(boolean cancel) Set to true in order to prevent Towny from keeping the inventory.- Specified by:
setCancelled
in interfaceorg.bukkit.event.Cancellable
-
getHandlers
public org.bukkit.event.HandlerList getHandlers()- Specified by:
getHandlers
in classorg.bukkit.event.Event
-
getHandlerList
public static org.bukkit.event.HandlerList getHandlerList() -
getPlayer
public org.bukkit.entity.Player getPlayer()- Returns:
- the player whose inventory is going to be kept.
-
getResident
- Returns:
- resident Resident or null of the player.
-
getLocation
public org.bukkit.Location getLocation()- Returns:
- the location where the player died.
-
getPlayerDeathEvent
public org.bukkit.event.entity.PlayerDeathEvent getPlayerDeathEvent()- Returns:
- the PlayerDeathEvent that killed the player.
-
getKiller
- Returns:
- Resident that killed the player, if they died to another player, or null.
-
getTownOrNull
- Returns:
- town Town or null, if the player died in the wilderness.
-
isWilderness
public boolean isWilderness()- Returns:
- true when the Player has died in the wilderness.
-