Class PlayerKeepsExperienceEvent

java.lang.Object
org.bukkit.event.Event
com.palmergames.bukkit.towny.event.player.PlayerKeepsExperienceEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class PlayerKeepsExperienceEvent extends org.bukkit.event.Event implements org.bukkit.event.Cancellable
  • Constructor Details

    • PlayerKeepsExperienceEvent

      public PlayerKeepsExperienceEvent(org.bukkit.event.entity.PlayerDeathEvent event)
      An event thrown after a PlayerDeathEvent at HIGHEST priority. Thrown when Towny would opt to keep someone's experience and clear the dropped XP orbs.
      Parameters:
      event - PlayerDeathEvent
    • PlayerKeepsExperienceEvent

      public PlayerKeepsExperienceEvent(org.bukkit.event.entity.PlayerDeathEvent event, boolean keepExperience)
      An event thrown after a PlayerDeathEvent at HIGHEST priority. Thrown when Towny would opt to keep someone's experience and clear the dropped XP orbs.
      Parameters:
      event - PlayerDeathEvent
      keepExperience - Default state of the event.
  • Method Details

    • isCancelled

      public boolean isCancelled()
      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 experience.
      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 experience 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.