Class AsyncPlayerTeleportEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
io.prismmc.prism.event.player.AsyncPlayerTeleportEvent
All Implemented Interfaces:
Cancellable

@NullMarked public class AsyncPlayerTeleportEvent extends PlayerEvent implements Cancellable
Called before a player is teleported through Entity.teleportAsync(Location): by a plugin, a command, or the server. Folia never calls PlayerTeleportEvent for these teleports; this event stands for it. The destination may be changed, or the teleport cancelled.

"Async" names the teleport, not the thread: the event is called on the thread that owns the player, where the player may be read and changed. A teleport to another world is followed, once the player is there, by AsyncPlayerWorldChangeEvent.

  • Constructor Details

  • Method Details

    • getFrom

      public Location getFrom()
      Where the player is before the teleport.
    • getTo

      public Location getTo()
      Where the player is about to be teleported.
    • setTo

      public void setTo(Location to)
      Sends the player somewhere else, in this world or another one.
    • getCause

      Why the player is teleported.
    • changesWorld

      public boolean changesWorld()
      Whether the player changes world with this teleport, as it stands.
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface Cancellable
    • setCancelled

      public void setCancelled(boolean cancel)
      Cancels the teleport: the player stays where they are.
      Specified by:
      setCancelled in interface Cancellable
    • getHandlers

      public HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getHandlerList

      public static HandlerList getHandlerList()