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
  • 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 - PlayerDeathEvent
      keepInventory - Default state of the event.
  • Method Details

    • isCancelled

      public boolean isCancelled()
      When true, players will not keep their inventory.
      Specified by:
      isCancelled in interface org.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 interface org.bukkit.event.Cancellable
    • getHandlers

      public org.bukkit.event.HandlerList getHandlers()
      Specified by:
      getHandlers in class org.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

      public Resident 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

      @Nullable public @Nullable Resident getKiller()
      Returns:
      Resident that killed the player, if they died to another player, or null.
    • getTownOrNull

      @Nullable public @Nullable Town 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.