Package com.ranull.graves.listener
Class BlockPlaceListener
java.lang.Object
com.ranull.graves.listener.BlockPlaceListener
- All Implemented Interfaces:
org.bukkit.event.Listener
Listens for BlockPlaceEvent to prevent placing blocks in certain conditions.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBlockPlaceListener
(Graves plugin) Constructs a new BlockPlaceListener with the specified Graves plugin. -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
isGraveBlock
(Grave grave) Checks if the block is a grave block.private boolean
isTokenItem
(org.bukkit.event.block.BlockPlaceEvent event) Checks if the item being used to place the block is a token.void
onBlockPlace
(org.bukkit.event.block.BlockPlaceEvent event) Handles BlockPlaceEvent to prevent placing blocks if they are graves or if the item being used is a token.
-
Field Details
-
plugin
-
-
Constructor Details
-
BlockPlaceListener
Constructs a new BlockPlaceListener with the specified Graves plugin.- Parameters:
plugin
- The Graves plugin instance.
-
-
Method Details
-
onBlockPlace
public void onBlockPlace(org.bukkit.event.block.BlockPlaceEvent event) Handles BlockPlaceEvent to prevent placing blocks if they are graves or if the item being used is a token.- Parameters:
event
- The BlockPlaceEvent to handle.
-
isGraveBlock
Checks if the block is a grave block.- Parameters:
grave
- The grave to check.- Returns:
- True if the block is a grave, false otherwise.
-
isTokenItem
private boolean isTokenItem(org.bukkit.event.block.BlockPlaceEvent event) Checks if the item being used to place the block is a token.- Parameters:
event
- The BlockPlaceEvent.- Returns:
- True if the item is a token, false otherwise.
-