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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result
-
Constructor Summary
ConstructorDescriptionPlayerKeepsExperienceEvent
(org.bukkit.event.entity.PlayerDeathEvent event) An event thrown after a PlayerDeathEvent at HIGHEST priority.PlayerKeepsExperienceEvent
(org.bukkit.event.entity.PlayerDeathEvent event, boolean keepExperience) 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
boolean
void
setCancelled
(boolean cancel) Set to true in order to prevent Towny from keeping the experience.Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
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
- PlayerDeathEventkeepExperience
- Default state of the event.
-
-
Method Details
-
isCancelled
public boolean isCancelled()- 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 experience.- 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 experience 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.
-