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
ConstructorDescriptionPlayerRightClickEvent
(PlayerInteractEvent originalEvent) This constructs a newPlayerRightClickEvent
based on the originalPlayerInteractEvent
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
This method cancels thePlayerRightClickEvent
.getHand()
This returns the hand that was used in this interaction.static HandlerList
This returns the originalPlayerInteractEvent
that triggered thisPlayerRightClickEvent
.getItem()
void
setUseBlock
(Event.Result result) void
setUseItem
(Event.Result result) useBlock()
useItem()
Methods inherited from class org.bukkit.event.player.PlayerEvent
getPlayer
Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
Constructor Details
-
PlayerRightClickEvent
This constructs a newPlayerRightClickEvent
based on the originalPlayerInteractEvent
. TheEvent.Result
of the originalPlayerInteractEvent
will be copied.- Parameters:
originalEvent
- The originalPlayerInteractEvent
-
-
Method Details
-
getInteractEvent
This returns the originalPlayerInteractEvent
that triggered thisPlayerRightClickEvent
.- Returns:
- The original
PlayerInteractEvent
-
getItem
-
getHand
This returns the hand that was used in this interaction. Can either beEquipmentSlot.HAND
orEquipmentSlot.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:
getHandlers
in classEvent
-