Package org.bukkit.event.player
Class PlayerSpawnChangeEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
org.bukkit.event.player.PlayerSpawnChangeEvent
- All Implemented Interfaces:
Cancellable
This event is fired when the spawn point of the player is changed.
- API Note:
- draft API
-
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
ConstructorDescriptionPlayerSpawnChangeEvent
(Player player, Location newSpawn, boolean forced, PlayerSpawnChangeEvent.Cause cause) -
Method Summary
Modifier and TypeMethodDescriptiongetCause()
Gets the cause of spawn change.static HandlerList
Gets the new spawn to be set.boolean
Gets the cancellation state of this event.boolean
isForced()
Gets if the spawn position will be used regardless of bed obstruction rules.void
setCancelled
(boolean cancel) Sets the cancellation state of this event.void
setForced
(boolean forced) Sets if the spawn position will be used regardless of bed obstruction rules.void
setNewSpawn
(Location newSpawn) Sets the new spawn location.Methods inherited from class org.bukkit.event.player.PlayerEvent
getPlayer
Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
Constructor Details
-
PlayerSpawnChangeEvent
public PlayerSpawnChangeEvent(@NotNull Player player, @Nullable Location newSpawn, boolean forced, @NotNull PlayerSpawnChangeEvent.Cause cause)
-
-
Method Details
-
getCause
Gets the cause of spawn change.- Returns:
- change cause
-
isForced
public boolean isForced()Gets if the spawn position will be used regardless of bed obstruction rules.- Returns:
- true if is forced
-
setForced
public void setForced(boolean forced) Sets if the spawn position will be used regardless of bed obstruction rules.- Parameters:
forced
- true if forced
-
getNewSpawn
Gets the new spawn to be set.- Returns:
- new spawn location
-
setNewSpawn
Sets the new spawn location.- Parameters:
newSpawn
- new spawn location, with non-null world
-
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
-