Class PlayerMoveEvent

All Implemented Interfaces:
Cancellable
Direct Known Subclasses:
PlayerTeleportEvent

public class PlayerMoveEvent extends PlayerEvent implements Cancellable
Holds information for player movement events
  • Constructor Details

  • Method Details

    • isCancelled

      public boolean isCancelled()
      Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins

      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

      Specified by:
      isCancelled in interface Cancellable
      Returns:
      true if this event is cancelled
    • setCancelled

      public void setCancelled(boolean cancel)
      Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins

      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

      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancel - true if you wish to cancel this event
    • getFrom

      @NotNull public @NotNull Location getFrom()
      Gets the location this player moved from
      Returns:
      Location the player moved from
    • setFrom

      public void setFrom(@NotNull @NotNull Location from)
      Sets the location to mark as where the player moved from
      Parameters:
      from - New location to mark as the players previous location
    • getTo

      @NotNull public @NotNull Location getTo()
      Gets the location this player moved to
      Returns:
      Location the player moved to
    • setTo

      public void setTo(@NotNull @NotNull Location to)
      Sets the location that this player will move to
      Parameters:
      to - New Location this player will move to
    • hasChangedPosition

      public boolean hasChangedPosition()
      Check if the player has changed position (even within the same block) in the event
      Returns:
      whether the player has changed position or not
    • hasExplicitlyChangedPosition

      public boolean hasExplicitlyChangedPosition()
      Check if the player has changed position (even within the same block) in the event, disregarding a possible world change
      Returns:
      whether the player has changed position or not
    • hasChangedBlock

      public boolean hasChangedBlock()
      Check if the player has moved to a new block in the event
      Returns:
      whether the player has moved to a new block or not
    • hasExplicitlyChangedBlock

      public boolean hasExplicitlyChangedBlock()
      Check if the player has moved to a new block in the event, disregarding a possible world change
      Returns:
      whether the player has moved to a new block or not
    • hasChangedOrientation

      public boolean hasChangedOrientation()
      Check if the player has changed orientation in the event
      Returns:
      whether the player has changed orientation or not
    • getHandlers

      @NotNull public @NotNull HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getHandlerList

      @NotNull public static @NotNull HandlerList getHandlerList()