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.
  • Constructor Details

  • Method Details

    • getCause

      public PlayerSetSpawnEvent.Cause getCause()
      Gets the cause of this event.
      Returns:
      the cause
    • 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
    • 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
    • isForced

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

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

      public boolean willNotifyPlayer()
      Gets if this action will notify the player their spawn has been set.
      Returns:
      true to notify
    • 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
    • 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
    • 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
    • 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
    • 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
    • getHandlers

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

      public static HandlerList getHandlerList()