Class PlayerSpawnTeleportEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
net.mathias2246.buildmc.api.event.CustomPlayerEvent
net.mathias2246.buildmc.api.event.player.PlayerSpawnTeleportEvent
- All Implemented Interfaces:
org.bukkit.event.Cancellable
public class PlayerSpawnTeleportEvent
extends CustomPlayerEvent
implements org.bukkit.event.Cancellable
Called when a player uses the '/spawn' command to teleport to spawn.
If this event was cancelled the player won't be teleported.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result -
Field Summary
Fields inherited from class CustomPlayerEvent
metadataHolderFields inherited from class org.bukkit.event.player.PlayerEvent
player -
Constructor Summary
ConstructorsConstructorDescriptionPlayerSpawnTeleportEvent(@NotNull org.bukkit.entity.Player who, @NotNull org.bukkit.Location to) The default constructor for creatingPlayerSpawnTeleportEvent. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull org.bukkit.event.HandlerList@NotNull org.bukkit.event.HandlerListReturns theHandlerListfor this event type.@NotNull org.bukkit.LocationgetTo()Gets theLocationto where the player is teleported after waiting.booleanGets the cancellation state of this event.voidsetCancelled(boolean cancelled) Sets the cancellation state of this event.voidsetTo(@NotNull org.bukkit.Location to) Sets theLocationto where the player is teleported after waiting.Methods inherited from class CustomPlayerEvent
getMetadata, putMetadata, removeMetadataMethods inherited from class org.bukkit.event.player.PlayerEvent
getPlayerMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
PlayerSpawnTeleportEvent
public PlayerSpawnTeleportEvent(@NotNull @NotNull org.bukkit.entity.Player who, @NotNull @NotNull org.bukkit.Location to) The default constructor for creatingPlayerSpawnTeleportEvent.- Parameters:
who- The player who gets teleportedto- The location the player gets teleported to.
-
-
Method Details
-
setTo
public void setTo(@NotNull @NotNull org.bukkit.Location to) Sets theLocationto where the player is teleported after waiting.- Parameters:
to- The new teleport target location
-
getTo
@NotNull public @NotNull org.bukkit.Location getTo()Gets theLocationto where the player is teleported after waiting.- Returns:
- The teleport target location
-
isCancelled
public boolean isCancelled()Gets the cancellation state of this event.If the event was cancelled, the player will not be teleported to the target location.
- Specified by:
isCancelledin interfaceorg.bukkit.event.Cancellable- Returns:
- If this event was cancelled.
-
setCancelled
public void setCancelled(boolean cancelled) Sets the cancellation state of this event.If the event was cancelled, the player will not be teleported to the target location.
- Specified by:
setCancelledin interfaceorg.bukkit.event.Cancellable- Parameters:
cancelled- if this event should be cancelled or not.
-
getHandlers
@NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()Description copied from class:CustomPlayerEventReturns theHandlerListfor this event type.Bukkit requires each concrete event class to define its own static
HandlerListinstance and to return it from this method. This is necessary for Bukkitâs event registration and dispatch system.- Specified by:
getHandlersin classCustomPlayerEvent- Returns:
- the handler list for this event (never
null)
-
getHandlerList
@NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()
-