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
    Modifier and Type
    Field
    Description
    protected boolean
     
    protected final org.bukkit.event.entity.EntityDamageEvent.DamageCause
     
    protected final org.bukkit.entity.Entity
     
    protected final org.bukkit.Location
     
    protected String
     
    protected final TownBlock
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    TownyDamageEvent(org.bukkit.Location loc, org.bukkit.entity.Entity entity, org.bukkit.event.entity.EntityDamageEvent.DamageCause cause, TownBlock townblock, boolean cancelled)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.event.entity.EntityDamageEvent.DamageCause
    DamageCause of damage.
    org.bukkit.entity.Entity
     
    org.bukkit.Location
     
     
    @Nullable Town
    The Town where the damage has happened.
    @Nullable TownBlock
    The TownBlock 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      protected final TownBlock townblock
    • cancelled

      protected boolean cancelled
    • message

      protected String 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 interface org.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 interface org.bukkit.event.Cancellable
    • getTown

      @Nullable public @Nullable Town getTown()
      The Town 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

      @Nullable public @Nullable TownBlock getTownBlock()
      The TownBlock 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

      public String getMessage()
      Returns:
      cancellation message shown when the damage is cancelled.
    • setMessage

      public void setMessage(String message)
      Parameters:
      message - Message shown when the damage is cancelled.
    • getCause

      public org.bukkit.event.entity.EntityDamageEvent.DamageCause getCause()
      DamageCause of damage.
      Returns:
      DamageCause.