public class PlayerMoveEvent extends PlayerEvent implements Cancellable
Event.Result
player
Constructor and Description |
---|
PlayerMoveEvent(@NotNull Player player,
@NotNull Location from,
@Nullable Location to) |
Modifier and Type | Method and Description |
---|---|
@NotNull Location |
getFrom()
Gets the location this player moved from
|
static @NotNull HandlerList |
getHandlerList() |
@NotNull HandlerList |
getHandlers() |
@NotNull Location |
getTo()
Gets the location this player moved to
|
boolean |
hasChangedBlock()
Check if the player has moved to a new block in the event
|
boolean |
hasChangedOrientation()
Check if the player has changed orientation in the event
|
boolean |
hasChangedPosition()
Check if the player has changed position (even within the same block) in the event
|
boolean |
hasExplicitlyChangedBlock()
Check if the player has moved to a new block in the event, disregarding a possible world change
|
boolean |
hasExplicitlyChangedPosition()
Check if the player has changed position (even within the same block) in the event, disregarding a possible world change
|
boolean |
isCancelled()
Gets the cancellation state of this event.
|
void |
setCancelled(boolean cancel)
Sets the cancellation state of this event.
|
void |
setFrom(@NotNull Location from)
Sets the location to mark as where the player moved from
|
void |
setTo(@NotNull Location to)
Sets the location that this player will move to
|
getPlayer
callEvent, getEventName, isAsynchronous
public boolean isCancelled()
If a move or teleport event is cancelled, the player will be moved or teleported back to the Location as defined by getFrom(). This will not fire an event
isCancelled
in interface Cancellable
public void setCancelled(boolean cancel)
If a move or teleport event is cancelled, the player will be moved or teleported back to the Location as defined by getFrom(). This will not fire an event
setCancelled
in interface Cancellable
cancel
- true if you wish to cancel this event@NotNull public @NotNull Location getFrom()
public void setFrom(@NotNull @NotNull Location from)
from
- New location to mark as the players previous location@NotNull public @NotNull Location getTo()
public void setTo(@NotNull @NotNull Location to)
to
- New Location this player will move topublic boolean hasChangedPosition()
public boolean hasExplicitlyChangedPosition()
public boolean hasChangedBlock()
public boolean hasExplicitlyChangedBlock()
public boolean hasChangedOrientation()
@NotNull public @NotNull HandlerList getHandlers()
getHandlers
in class Event
@NotNull public static @NotNull HandlerList getHandlerList()
Copyright © 2021. All rights reserved.