Class TownPreClaimEvent

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

public class TownPreClaimEvent extends CancellableTownyEvent
Runs before town banks are charged Provides raw town block
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.bukkit.event.Event

    org.bukkit.event.Event.Result
  • Constructor Summary

    Constructors
    Constructor
    Description
    TownPreClaimEvent(Town town, TownBlock townBlock, org.bukkit.entity.Player player, boolean isOutpost, boolean isHomeblock, boolean isOverClaim)
    This event runs when a town is made and when a town attempts to claim land.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.bukkit.event.HandlerList
     
    @NotNull org.bukkit.event.HandlerList
     
    org.bukkit.entity.Player
    Useful to send the player a message.
    The town which is claiming this TownBlock If isHomeblock is true, then this could be the first TownBlock claimed by a town upon Town-creation.
    The TownBlock which is being claimed.
    boolean
    Whether the townblock being claimed will be a homeblock.
    boolean
    Whether the townblock being claimed will be an outpost.
    boolean
    Whether the claim has resulted from takeoverclaim.

    Methods inherited from class com.palmergames.bukkit.towny.event.CancellableTownyEvent

    getCancelMessage, isCancelled, setCancelled, setCancelMessage

    Methods inherited from class org.bukkit.event.Event

    getEventName, isAsynchronous

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TownPreClaimEvent

      public TownPreClaimEvent(Town town, TownBlock townBlock, org.bukkit.entity.Player player, boolean isOutpost, boolean isHomeblock, boolean isOverClaim)
      This event runs when a town is made and when a town attempts to claim land.

      When a selection of townblocks are claimed, if even one townblock is prevented using this event, all the claims will be prevented.

      This event will throw an error message to the player that requires 2 %s, the first of which will be the number of blocked claims in a selection. The second of which is the total number of townblocks that were in the selection.

      If you are using CancellableTownyEvent.setCancelMessage(String) on this event be sure to supply two instances of %s.

      Parameters:
      town - Town which is claiming.
      townBlock - TownBlock which is being claimed.
      player - Player who is doing the claiming.
      isOutpost - True if the TownBlock will become an outpost.
      isHomeblock - True if the TownBlock will become a homeblock.
      isOverClaim - True if the claim has resulted from takeoverclaim.
  • Method Details

    • isOverClaim

      public boolean isOverClaim()
      Whether the claim has resulted from takeoverclaim.
      Returns:
      true if the claim resulted from /t takeoverclaim.
    • isOutpost

      public boolean isOutpost()
      Whether the townblock being claimed will be an outpost.
      Returns:
      true if it will become an outpost.
    • isHomeBlock

      public boolean isHomeBlock()
      Whether the townblock being claimed will be a homeblock. If this is being thrown because a town is about to be made, the Town object will be unfinished. Many parts of the Town object will throw errors if accessed. If there are multiple blocks being claimed using the larger selection commands, this will return true for every block in the selection, only the first would become a homeblock. Cancelling the event will cause all claims to be cancelled.
      Returns:
      true if the townblock will become a homeblock, or if many townblocks are being claimed at once.
    • getTownBlock

      public TownBlock getTownBlock()
      The TownBlock which is being claimed. If isHomeblock is true, then this could be the first TownBlock claimed by a town upon Town-creation. In this scenario the Town object has not finished initializing and many methods in the TownBlock object could return errors when used.
      Returns:
      the new TownBlock.
    • getTown

      public Town getTown()
      The town which is claiming this TownBlock If isHomeblock is true, then this could be the first TownBlock claimed by a town upon Town-creation. In this scenario the Town object has not finished initializing and many methods in the Town object could return errors when used.
      Returns:
      the town
    • getPlayer

      public org.bukkit.entity.Player getPlayer()
      Useful to send the player a message.
      Returns:
      the player who's having their claim canceled.
    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Specified by:
      getHandlers in class org.bukkit.event.Event