Class PlayerItemHeldEvent
java.lang.Object
fr.fidorial.event.player.PlayerItemHeldEvent
- All Implemented Interfaces:
Cancellable, Event, PlayerEvent
Fired when a player selects another hotbar slot, with the number keys or the mouse wheel.
- Since:
- 0.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionPlayerItemHeldEvent(Player player, int previousSlot, int newSlot) Creates an event. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturnstrueif the action this event describes will not happen.intnewSlot()Returns the hotbar slot the player selects,0-8.player()Returns the player involved in this event.intReturns the hotbar slot selected before,0-8.voidsetCancelled(boolean cancelled) Prevents or re-allows the action this event describes.
-
Constructor Details
-
PlayerItemHeldEvent
Creates an event.- Parameters:
player- the playerpreviousSlot- the slot selected before,0-8newSlot- the slot selected now,0-8- Since:
- 0.1.0
-
-
Method Details
-
player
Description copied from interface:PlayerEventReturns the player involved in this event.- Specified by:
playerin interfacePlayerEvent- Returns:
- the player involved in this event
-
previousSlot
public int previousSlot()Returns the hotbar slot selected before,0-8.- Returns:
- the hotbar slot selected before,
0-8 - Since:
- 0.1.0
-
newSlot
public int newSlot()Returns the hotbar slot the player selects,0-8.- Returns:
- the hotbar slot the player selects,
0-8 - Since:
- 0.1.0
-
isCancelled
public boolean isCancelled()Description copied from interface:CancellableReturnstrueif the action this event describes will not happen.- Specified by:
isCancelledin interfaceCancellable- Returns:
trueif the action this event describes will not happen
-
setCancelled
public void setCancelled(boolean cancelled) Description copied from interface:CancellablePrevents or re-allows the action this event describes.- Specified by:
setCancelledin interfaceCancellable- Parameters:
cancelled-trueto prevent it
-