Class BlockPlaceListener

java.lang.Object
com.ranull.graves.listener.BlockPlaceListener
All Implemented Interfaces:
org.bukkit.event.Listener

public class BlockPlaceListener extends Object implements org.bukkit.event.Listener
Listens for BlockPlaceEvent to prevent placing blocks in certain conditions.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Graves
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new BlockPlaceListener with the specified Graves plugin.
  • Method Summary

    Modifier and Type
    Method
    Description
    private boolean
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • plugin

      private final Graves plugin
  • Constructor Details

    • BlockPlaceListener

      public BlockPlaceListener(Graves plugin)
      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

      private boolean isGraveBlock(Grave grave)
      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.