Class BlockBreakHandler

java.lang.Object
io.github.thebusybiscuit.slimefun4.core.handlers.BlockBreakHandler
All Implemented Interfaces:
ItemHandler
Direct Known Subclasses:
SimpleBlockBreakHandler, VanillaInventoryDropHandler

public abstract class BlockBreakHandler extends Object implements ItemHandler
The BlockBreakHandler is called when a Block is broken which holds a SlimefunItem. The BlockBreakHandler provides three methods for this, one for block breaking caused by a Player, one for a MinerAndroid and one method for a Block being destroyed by an explosion.
Author:
TheBusyBiscuit
See Also:
  • Constructor Details

    • BlockBreakHandler

      protected BlockBreakHandler(boolean allowAndroids, boolean allowExplosions)
      This constructs a new BlockBreakHandler.
      Parameters:
      allowAndroids - Whether a MinerAndroid is allowed to break blocks of this type
      allowExplosions - Whether blocks of this type are allowed to be broken by explosions
  • Method Details

    • onPlayerBreak

      @ParametersAreNonnullByDefault public abstract void onPlayerBreak(BlockBreakEvent e, ItemStack item, List<ItemStack> drops)
    • onExplode

      @ParametersAreNonnullByDefault public void onExplode(Block b, List<ItemStack> drops)
    • onAndroidBreak

      @ParametersAreNonnullByDefault public void onAndroidBreak(AndroidMineEvent e)
    • isExplosionAllowed

      public boolean isExplosionAllowed(@Nonnull Block b)
      This returns whether an explosion is able to break the given Block.
      Parameters:
      b - The Block
      Returns:
      Whether explosions can destroy this Block
    • isAndroidAllowed

      public boolean isAndroidAllowed(@Nonnull Block b)
      This returns whether a MinerAndroid is allowed to break the given Block.
      Parameters:
      b - The Block
      Returns:
      Whether androids can break the given Block
    • getIdentifier

      public final Class<? extends ItemHandler> getIdentifier()
      Description copied from interface: ItemHandler
      This method returns the identifier for this ItemHandler. We use a Class identifier to group Item Handlers together.
      Specified by:
      getIdentifier in interface ItemHandler
      Returns:
      The Class identifier for this ItemHandler