Class PlayerSwingEvent

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

public final class PlayerSwingEvent extends Object implements PlayerEvent, Cancellable
Fired when a player swings their arm with the attack key (left click by default), whether or not something is hit.

Cancelling the event hides the swing from the other players. Listeners run on the network thread of the player, keep them short.

Since:
0.1.0
  • Constructor Details

    • PlayerSwingEvent

      public PlayerSwingEvent(Player player)
      Creates an event.
      Parameters:
      player - the player swinging
      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
    • 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