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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTownyDamageEvent(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.DamageCausegetCause()DamageCause of damage.org.bukkit.entity.Entityorg.bukkit.Location@Nullable TowngetTown()TheTownwhere the damage has happened.@Nullable TownBlockTheTownBlockthis action occured in, or null if in the wilderness.booleanDid this action occur inside of a town's townblock?booleanWhether the event has been cancelled.booleanDid this action occur in the wilderness?voidsetCancelled(boolean cancel) Set the event to cancelled.voidsetMessage(String message) Methods inherited from class org.bukkit.event.Event
callEvent, 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:
isCancelledin 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:
setCancelledin interfaceorg.bukkit.event.Cancellable
-
getTown
TheTownwhere 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
TheTownBlockthis 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.
-