Class PlayerUseSpecialItemEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
de.marcely.bedwars.api.event.player.PlayerUseSpecialItemEvent
- All Implemented Interfaces:
- ArenaEvent,- Cancellable
Gets called when a player is using a special item while he's in a game
- 
Nested Class SummaryNested classes/interfaces inherited from class org.bukkit.event.EventEvent.Result
- 
Field SummaryFields inherited from class org.bukkit.event.player.PlayerEventplayer
- 
Constructor SummaryConstructorsConstructorDescriptionPlayerUseSpecialItemEvent(Player player, SpecialItem specialItem, Arena arena, ItemStack item, boolean isOffHand, @Nullable Block clickedBlock, @Nullable BlockFace clickedBlockFace, boolean takeItem) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddSessionListener(Consumer<SpecialItemUseSession> callback) Adds a listener that gets called once the session has been initiated.getArena()Returns the arena in which the player has used the item.@Nullable BlockReturns the block on which the player clicked.@Nullable BlockFaceReturns the block face on which the player clicked.static HandlerListintReturns the inventory slot in which the item is located.getItem()Returns the item with which the player interacted.Returns the listeners that will be called once the session has been initiated.Returns the special item that the player has used.booleanReturns whether the plugin will accept the handling of the natural behaviour of whatever would actually happen.booleanReturns whether the player used the item in his off-hand.booleanReturns whether the item will be taken from the players inventory.voidsetNaturalInteractionCancelled(boolean newState) Set whether the plugin should accept the handling of the natural behaviour of whatever would actually happen.voidsetTakingItem(boolean takeItem) Set whether the item should be taken away from the player.Methods inherited from class org.bukkit.event.player.PlayerEventgetPlayerMethods inherited from class org.bukkit.event.EventgetEventName, isAsynchronousMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.bukkit.event.CancellableisCancelled, setCancelled
- 
Constructor Details- 
PlayerUseSpecialItemEvent
 
- 
- 
Method Details- 
getSpecialItemReturns the special item that the player has used.- Returns:
- The special item that has been used
 
- 
getArenaReturns the arena in which the player has used the item.- Specified by:
- getArenain interface- ArenaEvent
- Returns:
- The arena involved in this
 
- 
getItemReturns the item with which the player interacted.- Returns:
- The item that the player right-clicked
 
- 
isOffHandpublic boolean isOffHand()Returns whether the player used the item in his off-hand.This method always returns false on 1.8.8, as off-hand got added with 1.9. - Returns:
- If the player used the item in his off-hand
 
- 
getClickedBlockReturns the block on which the player clicked.Can be nullwhen the player used the item while looking to the sky or at an hologram.- Returns:
- The block that has been clicked
 
- 
getClickedBlockFaceReturns the block face on which the player clicked.Can be nullwhen the player used the item while looking to the sky or at an hologram.- Returns:
- The block face on which he clicked
 
- 
isTakingItempublic boolean isTakingItem()Returns whether the item will be taken from the players inventory.- Returns:
- If the item will be taken away
 
- 
setTakingItempublic void setTakingItem(boolean takeItem) Set whether the item should be taken away from the player.- Parameters:
- takeItem- If the item shall be taken away
 
- 
isNaturalInteractionCancelledpublic boolean isNaturalInteractionCancelled()Returns whether the plugin will accept the handling of the natural behaviour of whatever would actually happen.For instance, when holding a block, the player would (possibly) place the block. By default, the plugin returns trueunless it has been changed usingsetNaturalInteractionCancelled(boolean).- Returns:
- If the natural behaviour of the interaction will be processed
 
- 
setNaturalInteractionCancelledpublic void setNaturalInteractionCancelled(boolean newState) Set whether the plugin should accept the handling of the natural behaviour of whatever would actually happen.For instance, when holding a block, the player would (possibly) place the block. By default, the plugin has set it to true.- Parameters:
- newState- If the natural behaviour of the interaction shall be processed
 
- 
getInventorySlotpublic int getInventorySlot()Returns the inventory slot in which the item is located.- Returns:
- The inventory slot of the item
 
- 
addSessionListenerAdds a listener that gets called once the session has been initiated.The initiation occurs immediately after processing this event-loop. It might not occur at all if this event is cancelled or an error occurs during initiation. - Parameters:
- callback- The callback that gets called once the session has been initiated
 
- 
getSessionListenersReturns the listeners that will be called once the session has been initiated.- Returns:
- The listeners that will be called once the session has been initiated
- See Also:
 
- 
getHandlers- Specified by:
- getHandlersin class- Event
 
- 
getHandlerList
 
-