Class TownyDamageEvent
java.lang.Object
org.bukkit.event.Event
com.palmergames.bukkit.towny.event.damage.TownyDamageEvent
- All Implemented Interfaces:
org.bukkit.event.Cancellable
- Direct Known Subclasses:
TownyDispenserDamageEntityEvent
,TownyExplosionDamagesEntityEvent
,TownyPlayerDamageEntityEvent
,TownyPlayerDamagePlayerEvent
public abstract class TownyDamageEvent
extends org.bukkit.event.Event
implements org.bukkit.event.Cancellable
- Author:
- LlmDl
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result
-
Field Summary
-
Constructor Summary
ConstructorDescriptionTownyDamageEvent
(org.bukkit.Location loc, org.bukkit.entity.Entity entity, org.bukkit.event.entity.EntityDamageEvent.DamageCause cause, TownBlock townblock, boolean cancelled) -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.event.entity.EntityDamageEvent.DamageCause
getCause()
DamageCause of damage.org.bukkit.entity.Entity
org.bukkit.Location
@Nullable Town
getTown()
TheTown
where the damage has happened.@Nullable TownBlock
TheTownBlock
this action occured in, or null if in the wilderness.boolean
Did this action occur inside of a town's townblock?boolean
Whether the event has been cancelled.boolean
Did this action occur in the wilderness?void
setCancelled
(boolean cancel) Set the event to cancelled.void
setMessage
(String message) Methods inherited from class org.bukkit.event.Event
getEventName, getHandlers, isAsynchronous
-
Field Details
-
entity
protected final org.bukkit.entity.Entity entity -
loc
protected final org.bukkit.Location loc -
cause
protected final org.bukkit.event.entity.EntityDamageEvent.DamageCause cause -
townblock
-
cancelled
protected boolean cancelled -
message
-
-
Constructor Details
-
TownyDamageEvent
public TownyDamageEvent(org.bukkit.Location loc, org.bukkit.entity.Entity entity, org.bukkit.event.entity.EntityDamageEvent.DamageCause cause, TownBlock townblock, boolean cancelled)
-
-
Method Details
-
isCancelled
public boolean isCancelled()Whether the event has been cancelled.- Specified by:
isCancelled
in interfaceorg.bukkit.event.Cancellable
-
setCancelled
public void setCancelled(boolean cancel) Set the event to cancelled. False meaning damage, True meaning damage will be prevented.- Specified by:
setCancelled
in interfaceorg.bukkit.event.Cancellable
-
getTown
TheTown
where the damage has happened.- Returns:
- town or null;
-
getLocation
public org.bukkit.Location getLocation()- Returns:
- Location of the entity being damaged.
-
getEntity
public org.bukkit.entity.Entity getEntity()- Returns:
- Entity being damaged.
-
getTownBlock
TheTownBlock
this action occured in, or null if in the wilderness.- Returns:
- TownBlock or null.
-
isInWilderness
public boolean isInWilderness()Did this action occur in the wilderness?- Returns:
- return true if this was in the wilderness.
-
hasTownBlock
public boolean hasTownBlock()Did this action occur inside of a town's townblock?- Returns:
- true if this has a townblock.
-
getMessage
- Returns:
- cancellation message shown when the damage is cancelled.
-
setMessage
- Parameters:
message
- Message shown when the damage is cancelled.
-
getCause
public org.bukkit.event.entity.EntityDamageEvent.DamageCause getCause()DamageCause of damage.- Returns:
- DamageCause.
-