Class PlayerSetSpawnEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
com.destroystokyo.paper.event.player.PlayerSetSpawnEvent
All Implemented Interfaces:
Cancellable

@NullMarked public class PlayerSetSpawnEvent extends PlayerEvent implements Cancellable
Called when a player's spawn is set, either by themselves or otherwise.
Cancelling this event will prevent the spawn from being set.
Since:
1.17.1
  • Constructor Details

  • Method Details

    • getCause

      public PlayerSetSpawnEvent.Cause getCause()
      Gets the cause of this event.
      Returns:
      the cause
      Since:
      1.17.1
    • getLocation

      public @Nullable Location getLocation()
      Gets the location that the spawn is set to. The yaw of this location is the spawn angle. Mutating this location will change the resulting spawn point of the player. Use Location.clone() to get a copy of this location.
      Returns:
      the spawn location, or null if removing the location
      Since:
      1.17.1
    • setLocation

      public void setLocation(@Nullable Location location)
      Sets the location to be set as the spawn location. The yaw of this location is the spawn angle.
      Parameters:
      location - the spawn location, or null to remove the spawn location
      Since:
      1.17.1
    • isForced

      public boolean isForced()
      Gets if this is a force spawn location
      Returns:
      true if forced
      Since:
      1.17.1
    • setForced

      public void setForced(boolean forced)
      Sets if this is a forced spawn location
      Parameters:
      forced - true to force
      Since:
      1.17.1
    • willNotifyPlayer

      public boolean willNotifyPlayer()
      Gets if this action will notify the player their spawn has been set.
      Returns:
      true to notify
      Since:
      1.17.1
    • setNotifyPlayer

      public void setNotifyPlayer(boolean notifyPlayer)
      Sets if this action will notify the player that their spawn has been set.
      Parameters:
      notifyPlayer - true to notify
      Since:
      1.17.1
    • getNotification

      public @Nullable Component getNotification()
      Gets the notification message that will be sent to the player if willNotifyPlayer() returns true.
      Returns:
      null if no notification
      Since:
      1.17.1
    • setNotification

      public void setNotification(@Nullable Component notification)
      Sets the notification message that will be sent to the player.
      Parameters:
      notification - null to send no message
      Since:
      1.17.1
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: Cancellable
      Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins
      Specified by:
      isCancelled in interface Cancellable
      Returns:
      true if this event is cancelled
      Since:
      1.17.1
    • setCancelled

      public void setCancelled(boolean cancel)
      Description copied from interface: Cancellable
      Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.
      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancel - true if you wish to cancel this event
      Since:
      1.17.1
    • getHandlers

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

      public static HandlerList getHandlerList()
      Since:
      1.17.1