Package com.destroystokyo.paper.event.player

# Class PlayerSetSpawnEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
com.destroystokyo.paper.event.player.PlayerSetSpawnEvent

All Implemented Interfaces:
  `Cancellable`

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.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static enum`
`PlayerSetSpawnEvent.Cause`

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

`Event.Result`

## Field Summary

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

`player`

## Constructor Summary

Constructors
Constructor
Description
`PlayerSetSpawnEvent(@NotNull Player who, @NotNull PlayerSetSpawnEvent.Cause cause, @Nullable Location location, boolean forced, boolean notifyPlayer, @Nullable Component notification)`

## Method Summary

Modifier and Type
Method
Description
`@NotNull PlayerSetSpawnEvent.Cause`
`getCause()`
Gets the cause of this event.
`static @NotNull HandlerList`
`getHandlerList()`
`@NotNull HandlerList`
`getHandlers()`
`@Nullable Location`
`getLocation()`
Gets the location that the spawn is set to.
`@Nullable Component`
`getNotification()`
Gets the notification message that will be sent to the player if `willNotifyPlayer()` returns true.
`boolean`
`isCancelled()`
Gets the cancellation state of this event.
`boolean`
`isForced()`
Gets if this is a force spawn location
`void`
`setCancelled(boolean cancel)`
Sets the cancellation state of this event.
`void`
`setForced(boolean forced)`
Sets if this is a forced spawn location
`void`
`setLocation(@Nullable Location location)`
Sets the location to be set as the spawn location.
`void`
`setNotification(@Nullable Component notification)`
Sets the notification message that will be sent to the player.
`void`
`setNotifyPlayer(boolean notifyPlayer)`
Sets if this action will notify the player that their spawn has been set.
`boolean`
`willNotifyPlayer()`
Gets if this action will notify the player their spawn has been set.

### 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 java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### PlayerSetSpawnEvent

public PlayerSetSpawnEvent(@NotNull @NotNull Player who, @NotNull @NotNull PlayerSetSpawnEvent.Cause cause, @Nullable @Nullable Location location, boolean forced, boolean notifyPlayer, @Nullable @Nullable Component notification)

## Method Details

### getCause

@NotNull public @NotNull PlayerSetSpawnEvent.Cause getCause()
Gets the cause of this event.

Returns:
  the cause

### getLocation

@Nullable 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 @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

@Nullable 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 @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

@NotNull public @NotNull HandlerList getHandlers()

Specified by:
  `getHandlers` in class `Event`

### getHandlerList

@NotNull public static @NotNull HandlerList getHandlerList()