Class OnEventAction

java.lang.Object
org.bukkit.event.Event
fr.fuzeblocks.homeplugin.event.OnEventAction
All Implemented Interfaces:
org.bukkit.event.Cancellable
Direct Known Subclasses:
OnHomeCreatedEvent, OnHomeDeletedEvent, OnHomeTeleportEvent, OnRtpEvent, OnSpawnCreatedEvent, OnSpawnDeletedEvent, OnSpawnTeleportEvent, OnTeleportTaskCancelledEvent, OnTpaAcceptedEvent, OnTpaCreatedEvent, OnTpaDeniedEvent

public class OnEventAction extends org.bukkit.event.Event implements org.bukkit.event.Cancellable
Base custom event for teleport-like actions. Provides explicit origin (from) and destination (to). getLocation() is retained for backward compatibility and returns the destination (to).
  • Nested Class Summary

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

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

    Constructors
    Constructor
    Description
    Convenience constructor for TPA events.
    OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location location)
    Backward-compatible: 'location' is treated as the destination ("to").
    OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location location, SyncMethod type)
    Backward-compatible: 'location' is treated as the destination ("to").
    OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location location, SyncMethod type, String homeName)
    Backward-compatible: 'location' is treated as the destination ("to").
    OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location location, String homeName)
    Backward-compatible: 'location' is treated as the destination ("to").
    OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location from, org.bukkit.Location to)
    Preferred constructor with explicit origin and destination (no type).
    OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location from, org.bukkit.Location to, SyncMethod type)
    Preferred constructor with explicit origin and destination and optional type.
    OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location from, org.bukkit.Location to, SyncMethod type, String homeName)
    Preferred constructor with explicit origin and destination, optional type, and home name.
    OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location from, org.bukkit.Location to, String homeName)
    Preferred constructor with explicit origin and destination and home name (no type).
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.Location
    Origin location (where the player came FROM).
    static org.bukkit.event.HandlerList
    Gets handler list.
    org.bukkit.event.HandlerList
     
    Gets home name.
    org.bukkit.Location
    Deprecated.
    org.bukkit.entity.Player
    Gets player.
    org.bukkit.Location
    Destination location (where the player is going TO).
    Gets type.
    boolean
     
    void
    setCancelled(boolean b)
     
    void
    setHomeName(String homeName)
    Sets home name.

    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

    • OnEventAction

      public OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location from, org.bukkit.Location to, SyncMethod type)
      Preferred constructor with explicit origin and destination and optional type.
      Parameters:
      player - the player
      from - the from
      to - the to
      type - the type
    • OnEventAction

      public OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location from, org.bukkit.Location to, SyncMethod type, String homeName)
      Preferred constructor with explicit origin and destination, optional type, and home name.
      Parameters:
      player - the player
      from - the from
      to - the to
      type - the type
      homeName - the home name
    • OnEventAction

      public OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location from, org.bukkit.Location to)
      Preferred constructor with explicit origin and destination (no type).
      Parameters:
      player - the player
      from - the from
      to - the to
    • OnEventAction

      public OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location from, org.bukkit.Location to, String homeName)
      Preferred constructor with explicit origin and destination and home name (no type).
      Parameters:
      player - the player
      from - the from
      to - the to
      homeName - the home name
    • OnEventAction

      public OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location location, SyncMethod type)
      Backward-compatible: 'location' is treated as the destination ("to"). 'from' defaults to the player's current location at event creation time.
      Parameters:
      player - the player
      location - the location
      type - the type
    • OnEventAction

      public OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location location)
      Backward-compatible: 'location' is treated as the destination ("to"). 'from' defaults to the player's current location at event creation time.
      Parameters:
      player - the player
      location - the location
    • OnEventAction

      public OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location location, SyncMethod type, String homeName)
      Backward-compatible: 'location' is treated as the destination ("to"). 'from' defaults to the player's current location at event creation time.
      Parameters:
      player - the player
      location - the location
      type - the type
      homeName - the home name
    • OnEventAction

      public OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location location, String homeName)
      Backward-compatible: 'location' is treated as the destination ("to"). 'from' defaults to the player's current location at event creation time.
      Parameters:
      player - the player
      location - the location
      homeName - the home name
    • OnEventAction

      public OnEventAction(TpaRequest tpaRequest)
      Convenience constructor for TPA events. Sets 'from' to the sender's current location and 'to' to the target's current location.
      Parameters:
      tpaRequest - the tpa request
  • Method Details

    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()
      Gets handler list.
      Returns:
      the handler list
    • getHandlers

      public org.bukkit.event.HandlerList getHandlers()
      Specified by:
      getHandlers in class org.bukkit.event.Event
    • getPlayer

      public org.bukkit.entity.Player getPlayer()
      Gets player.
      Returns:
      the player
    • getFrom

      public org.bukkit.Location getFrom()
      Origin location (where the player came FROM).
      Returns:
      the from
    • getTo

      public org.bukkit.Location getTo()
      Destination location (where the player is going TO).
      Returns:
      the to
    • getLocation

      @Deprecated public org.bukkit.Location getLocation()
      Deprecated.
      Backward-compatible getter for the destination. Prefer getTo() in new code.
      Returns:
      the location
    • getType

      public SyncMethod getType()
      Gets type.
      Returns:
      the type
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
    • setCancelled

      public void setCancelled(boolean b)
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
    • getHomeName

      public String getHomeName()
      Gets home name.
      Returns:
      the home name
    • setHomeName

      public void setHomeName(String homeName)
      Sets home name.
      Parameters:
      homeName - the home name