Class PlayerRightClickEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent
The
PlayerRightClickEvent is our custom version of the PlayerInteractEvent.
But it is only triggered on right click.
The main and (almost) sole purpose of this Event is to cache the SlimefunItem
of the ItemStack and/or Block involved.
This allows us (and addons) to efficiently check the used SlimefunItem without the need
to do a heavy lookup or item comparison.- Author:
- TheBusyBiscuit
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result -
Field Summary
Fields inherited from class org.bukkit.event.player.PlayerEvent
player -
Constructor Summary
ConstructorsConstructorDescriptionPlayerRightClickEvent(PlayerInteractEvent originalEvent) This constructs a newPlayerRightClickEventbased on the originalPlayerInteractEvent. -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()This method cancels thePlayerRightClickEvent.getHand()This returns the hand that was used in this interaction.static HandlerListThis returns the originalPlayerInteractEventthat triggered thisPlayerRightClickEvent.getItem()voidsetUseBlock(Event.Result result) voidsetUseItem(Event.Result result) useBlock()useItem()Methods inherited from class org.bukkit.event.player.PlayerEvent
getPlayerMethods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
Constructor Details
-
PlayerRightClickEvent
This constructs a newPlayerRightClickEventbased on the originalPlayerInteractEvent. TheEvent.Resultof the originalPlayerInteractEventwill be copied.- Parameters:
originalEvent- The originalPlayerInteractEvent
-
-
Method Details
-
getInteractEvent
This returns the originalPlayerInteractEventthat triggered thisPlayerRightClickEvent.- Returns:
- The original
PlayerInteractEvent
-
getItem
-
getHand
This returns the hand that was used in this interaction. Can either beEquipmentSlot.HANDorEquipmentSlot.OFF_HAND.- Returns:
- The hand used in this
Event
-
getClickedBlock
-
getClickedFace
-
getSlimefunItem
-
getSlimefunBlock
-
cancel
public void cancel()This method cancels thePlayerRightClickEvent. This will deny the item and block usage. -
useItem
-
useBlock
-
setUseItem
-
setUseBlock
-
getHandlerList
-
getHandlers
- Specified by:
getHandlersin classEvent
-