Class PlayerUseItemEvent
java.lang.Object
fr.fidorial.event.player.PlayerUseItemEvent
- All Implemented Interfaces:
Cancellable, Event, PlayerEvent
Fired when a player uses what they hold without aiming at a block.
- Since:
- 0.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionPlayerUseItemEvent(Player player, EquipmentSlotGroup hand, ItemStack item) Creates an event. -
Method Summary
Modifier and TypeMethodDescriptionhand()Returns the hand used,EquipmentSlotGroup.MAIN_HANDorEquipmentSlotGroup.OFF_HAND.booleanReturnstrueif the action this event describes will not happen.item()Returns what the hand holds,ItemStack.EMPTYwhen nothing.player()Returns the player involved in this event.voidsetCancelled(boolean cancelled) Prevents or re-allows the action this event describes.
-
Constructor Details
-
PlayerUseItemEvent
Creates an event.- Parameters:
player- the playerhand- the hand used,EquipmentSlotGroup.MAIN_HANDorEquipmentSlotGroup.OFF_HANDitem- what that hand holds,ItemStack.EMPTYwhen nothing- 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
-
hand
Returns the hand used,EquipmentSlotGroup.MAIN_HANDorEquipmentSlotGroup.OFF_HAND.- Returns:
- the hand used,
EquipmentSlotGroup.MAIN_HANDorEquipmentSlotGroup.OFF_HAND - Since:
- 0.1.0
-
item
Returns what the hand holds,ItemStack.EMPTYwhen nothing.- Returns:
- what the hand holds,
ItemStack.EMPTYwhen nothing - 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
-