Class PlayerSetSpawnEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
com.destroystokyo.paper.event.player.PlayerSetSpawnEvent
- All Implemented Interfaces:
Cancellable
Called when a player's spawn is set, either by themselves or otherwise.
Cancelling this event will prevent the spawn from being set.
Cancelling this event will prevent the spawn from being set.
-
Nested Class Summary
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
ConstructorDescriptionPlayerSetSpawnEvent
(@NotNull Player player, @NotNull PlayerSetSpawnEvent.Cause cause, @Nullable Location location, boolean forced, boolean notifyPlayer, @Nullable Component notification) -
Method Summary
Modifier and TypeMethodDescriptiongetCause()
Gets the cause of this event.static @NotNull HandlerList
Gets the location that the spawn is set to.Gets the notification message that will be sent to the player ifwillNotifyPlayer()
returns true.boolean
Gets the cancellation state of this event.boolean
isForced()
Gets if this is a force spawn locationvoid
setCancelled
(boolean cancel) Sets the cancellation state of this event.void
setForced
(boolean forced) Sets if this is a forced spawn locationvoid
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
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
-
Constructor Details
-
PlayerSetSpawnEvent
-
-
Method Details
-
getCause
Gets the cause of this event.- Returns:
- the cause
-
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. UseLocation.clone()
to get a copy of this location.- Returns:
- the spawn location, or
null
if removing the location
-
setLocation
Sets the location to be set as the spawn location. The yaw of this location is the spawn angle.- Parameters:
location
- the spawn location, ornull
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
Gets the notification message that will be sent to the player ifwillNotifyPlayer()
returns true.- Returns:
null
if no notification
-
setNotification
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 interfaceCancellable
- 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 interfaceCancellable
- Parameters:
cancel
- true if you wish to cancel this event
-
getHandlers
- Specified by:
getHandlers
in classEvent
-
getHandlerList
-