Class BlockInteractionEvent
java.lang.Object
org.bukkit.event.Event
com.github.darksoulq.abyssallib.server.event.custom.block.BlockInteractionEvent
- All Implemented Interfaces:
org.bukkit.event.Cancellable
public class BlockInteractionEvent
extends org.bukkit.event.Event
implements org.bukkit.event.Cancellable
An event that is triggered when a player interacts with a custom block.
This event is Cancellable, meaning the interaction can be prevented by a plugin.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionBlockInteractionEvent(@NotNull org.bukkit.entity.Player player, @NotNull CustomBlock block, @NotNull org.bukkit.block.BlockFace face, org.bukkit.Location interaction, @NotNull org.bukkit.event.block.Action action, @Nullable org.bukkit.inventory.ItemStack item) Constructs a newBlockInteractionEvent. -
Method Summary
Modifier and TypeMethodDescription@NotNull org.bukkit.event.block.ActionGets the action performed by the player (e.g., right-click, left-click).@NotNull CustomBlockgetBlock()Gets the block being interacted with.@NotNull org.bukkit.block.BlockFaceGets the face of the block being interacted with.static org.bukkit.event.HandlerListProvides a static method to retrieve the handler list, required by Bukkit.@NotNull org.bukkit.event.HandlerListGets the list of handlers listening to this event.@Nullable org.bukkit.LocationGets the location where the interaction occurred.@Nullable org.bukkit.inventory.ItemStackgetItem()Gets the item used by the player during the interaction.@NotNull org.bukkit.entity.PlayerGets the player interacting with the block.booleanChecks whether the event is cancelled.voidsetCancelled(boolean cancel) Sets the cancellation state of this event.Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
BlockInteractionEvent
public BlockInteractionEvent(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull CustomBlock block, @NotNull @NotNull org.bukkit.block.BlockFace face, org.bukkit.Location interaction, @NotNull @NotNull org.bukkit.event.block.Action action, @Nullable @Nullable org.bukkit.inventory.ItemStack item) Constructs a newBlockInteractionEvent.- Parameters:
player- The player interacting with the block.block- The block being interacted with.face- The face of the block being interacted with.interaction- The location where the interaction occurred.action- The action performed by the player.item- The item used by the player during the interaction.
-
-
Method Details
-
getBlock
Gets the block being interacted with.- Returns:
- The block being interacted with.
-
getPlayer
@NotNull public @NotNull org.bukkit.entity.Player getPlayer()Gets the player interacting with the block.- Returns:
- The player interacting with the block.
-
getBlockFace
@NotNull public @NotNull org.bukkit.block.BlockFace getBlockFace()Gets the face of the block being interacted with.- Returns:
- The face of the block being interacted with.
-
getInteractionPoint
@Nullable public @Nullable org.bukkit.Location getInteractionPoint()Gets the location where the interaction occurred.- Returns:
- The location of the interaction.
-
getAction
@NotNull public @NotNull org.bukkit.event.block.Action getAction()Gets the action performed by the player (e.g., right-click, left-click).- Returns:
- The action performed by the player.
-
getItem
@Nullable public @Nullable org.bukkit.inventory.ItemStack getItem()Gets the item used by the player during the interaction.- Returns:
- The item used by the player.
-
isCancelled
public boolean isCancelled()Checks whether the event is cancelled.- Specified by:
isCancelledin interfaceorg.bukkit.event.Cancellable- Returns:
trueif the event is cancelled;falseotherwise.
-
setCancelled
public void setCancelled(boolean cancel) Sets the cancellation state of this event.- Specified by:
setCancelledin interfaceorg.bukkit.event.Cancellable- Parameters:
cancel-trueto cancel the event,falseto allow it to proceed.
-
getHandlers
@NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()Gets the list of handlers listening to this event.- Specified by:
getHandlersin classorg.bukkit.event.Event- Returns:
- The handler list.
-
getHandlerList
public static org.bukkit.event.HandlerList getHandlerList()Provides a static method to retrieve the handler list, required by Bukkit.- Returns:
- The static
HandlerListfor this event type.
-