Class PlayerSpawnTeleportEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
net.mathias2246.buildmc.api.event.CustomPlayerEvent
net.mathias2246.buildmc.api.event.player.PlayerSpawnTeleportEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class PlayerSpawnTeleportEvent extends CustomPlayerEvent implements org.bukkit.event.Cancellable
Called when a player uses the '/spawn' command to teleport to spawn.

If this event was cancelled the player won't be teleported.

  • Nested Class Summary

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

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

    Fields inherited from class CustomPlayerEvent

    metadataHolder

    Fields inherited from class org.bukkit.event.player.PlayerEvent

    player
  • Constructor Summary

    Constructors
    Constructor
    Description
    PlayerSpawnTeleportEvent(@NotNull org.bukkit.entity.Player who, @NotNull org.bukkit.Location to)
    The default constructor for creating PlayerSpawnTeleportEvent.
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NotNull org.bukkit.event.HandlerList
     
    @NotNull org.bukkit.event.HandlerList
    Returns the HandlerList for this event type.
    @NotNull org.bukkit.Location
    Gets the Location to where the player is teleported after waiting.
    boolean
    Gets the cancellation state of this event.
    void
    setCancelled(boolean cancelled)
    Sets the cancellation state of this event.
    void
    setTo(@NotNull org.bukkit.Location to)
    Sets the Location to where the player is teleported after waiting.

    Methods inherited from class CustomPlayerEvent

    getMetadata, putMetadata, removeMetadata

    Methods inherited from class org.bukkit.event.player.PlayerEvent

    getPlayer

    Methods inherited from class org.bukkit.event.Event

    callEvent, getEventName, isAsynchronous

    Methods inherited from class Object

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

    • PlayerSpawnTeleportEvent

      public PlayerSpawnTeleportEvent(@NotNull @NotNull org.bukkit.entity.Player who, @NotNull @NotNull org.bukkit.Location to)
      The default constructor for creating PlayerSpawnTeleportEvent.
      Parameters:
      who - The player who gets teleported
      to - The location the player gets teleported to.
  • Method Details

    • setTo

      public void setTo(@NotNull @NotNull org.bukkit.Location to)
      Sets the Location to where the player is teleported after waiting.
      Parameters:
      to - The new teleport target location
    • getTo

      @NotNull public @NotNull org.bukkit.Location getTo()
      Gets the Location to where the player is teleported after waiting.
      Returns:
      The teleport target location
    • isCancelled

      public boolean isCancelled()
      Gets the cancellation state of this event.

      If the event was cancelled, the player will not be teleported to the target location.

      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
      Returns:
      If this event was cancelled.
    • setCancelled

      public void setCancelled(boolean cancelled)
      Sets the cancellation state of this event.

      If the event was cancelled, the player will not be teleported to the target location.

      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
      Parameters:
      cancelled - if this event should be cancelled or not.
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Description copied from class: CustomPlayerEvent
      Returns the HandlerList for this event type.

      Bukkit requires each concrete event class to define its own static HandlerList instance and to return it from this method. This is necessary for Bukkit’s event registration and dispatch system.

      Specified by:
      getHandlers in class CustomPlayerEvent
      Returns:
      the handler list for this event (never null)
    • getHandlerList

      @NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()