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 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
ConstructorDescriptionPlayerUseSpecialItemEvent
(Player player, SpecialItem specialItem, Arena arena, ItemStack item, boolean isOffHand, @Nullable Block clickedBlock, @Nullable BlockFace clickedBlockFace, boolean takeItem) -
Method Summary
Modifier and TypeMethodDescriptiongetArena()
Returns the arena in which the player has used the item.@Nullable Block
Returns the block on which the player clicked.@Nullable BlockFace
Returns the block face on which the player clicked.static HandlerList
getItem()
Returns the item with which the player interacted.Returns the special item that the player has used.boolean
Returns whether the plugin will accept the handling of the natural behaviour of whatever would actually happen.boolean
Returns whether the player used the item in his off-hand.boolean
Returns whether the item will be taken from the players inventory.void
setNaturalInteractionCancelled
(boolean newState) Set whether the plugin should accept the handling of the natural behaviour of whatever would actually happen.void
setTakingItem
(boolean takeItem) Set whether the item should be taken away from the player.Methods inherited from class org.bukkit.event.player.PlayerEvent
getPlayer
Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.bukkit.event.Cancellable
isCancelled, setCancelled
-
Constructor Details
-
PlayerUseSpecialItemEvent
-
-
Method Details
-
getSpecialItem
Returns the special item that the player has used.- Returns:
- The special item that has been used
-
getArena
Returns the arena in which the player has used the item.- Specified by:
getArena
in interfaceArenaEvent
- Returns:
- The arena involved in this
-
getItem
Returns the item with which the player interacted.- Returns:
- The item that the player right-clicked
-
isOffHand
public 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
-
getClickedBlock
Returns the block on which the player clicked.Can be
null
when the player used the item while looking to the sky or at an hologram.- Returns:
- The block that has been clicked
-
getClickedBlockFace
Returns the block face on which the player clicked.Can be
null
when the player used the item while looking to the sky or at an hologram.- Returns:
- The block face on which he clicked
-
isTakingItem
public boolean isTakingItem()Returns whether the item will be taken from the players inventory.- Returns:
- If the item will be taken away
-
setTakingItem
public void setTakingItem(boolean takeItem) Set whether the item should be taken away from the player.- Parameters:
takeItem
- If the item shall be taken away
-
isNaturalInteractionCancelled
public 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
true
unless it has been changed usingsetNaturalInteractionCancelled(boolean)
.- Returns:
- If the natural behaviour of the interaction will be processed
-
setNaturalInteractionCancelled
public 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
-
getHandlers
- Specified by:
getHandlers
in classEvent
-
getHandlerList
-