Making player mine a block

Discussion in 'Spigot Plugin Help' started by boranakinci_boom, Jun 15, 2021.

  1. Ok so I need to make the player mine a block instantly, while triggering BlockBreakEvent, I know breakNaturally make it kinda work but it does not trigger BlockBreakEvent
  2. You can use BlockDamageEvent.
  3. You could use the player interact event and set the block to air on interact and drop it via World#dropItem and then call the BlockBreakEvent yourself
  4. and how can I call the event myself?
  5. Use Interact Event instead and check if the action equals to left click block. BlockBreak is called only when you break the block, Interact is called, when you only click the block. ^^
    • Winner Winner x 3
  6. add this to a PlayerInteract event & make sure the action equals left click block
    ((CraftPlayer) event.getPlayer()).getHandle().playerInteractManager.breakBlock(new BlockPosition(x, y, z));

    this should make the player break the block at x,y,z and it calls BlockBreakEvent

    be careful though this could trigger anti-cheats & the event gets triggered for other plugins as well.