Class PlayerMoveEvent

java.lang.Object
fr.fidorial.event.player.PlayerMoveEvent
All Implemented Interfaces:
Cancellable, Event, PlayerEvent

public final class PlayerMoveEvent extends Object implements PlayerEvent, Cancellable
Fired when a player moves or turns, before the new position is applied.

Cancelling the event teleports the player back to from().

Since:
0.1.0
  • Constructor Details

    • PlayerMoveEvent

      public PlayerMoveEvent(Player player, Location from, Location to)
      Creates an event.
      Parameters:
      player - the player moving
      from - the location before the move
      to - the location after the move
      Since:
      0.1.0
  • Method Details

    • player

      public Player player()
      Description copied from interface: PlayerEvent
      Returns the player involved in this event.
      Specified by:
      player in interface PlayerEvent
      Returns:
      the player involved in this event
    • from

      public Location from()
      Returns the location before the move.
      Returns:
      the location before the move
      Since:
      0.1.0
    • to

      public Location to()
      Returns the location the player is moving to.
      Returns:
      the location the player is moving to
      Since:
      0.1.0
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: Cancellable
      Returns true if the action this event describes will not happen.
      Specified by:
      isCancelled in interface Cancellable
      Returns:
      true if the action this event describes will not happen
    • setCancelled

      public void setCancelled(boolean cancelled)
      Description copied from interface: Cancellable
      Prevents or re-allows the action this event describes.
      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancelled - true to prevent it