Block eventBlock = block;
if (player.getLocation().distanceSquared(block.getLocation()) > 36 || block.getTypeId() == 0) {
action = Action.LEFT_CLICK_AIR;
eventBlock = null;
}
PlayerInteractEvent interactEvent = EventFactory.onPlayerInteract(player, action, eventBlock, face);
// blocks don't get interacted with on left click, so ignore that
// attempt to use item in hand, that is, dig up the block
if (!BlockPlacementHandler.selectResult(interactEvent.useItemInHand(), true)) {
// the event was cancelled, get out of here
revert = true;
} else {
// emit damage event - cancel by default if holding a sword
boolean instaBreak = player.getGameMode() == GameMode.CREATIVE;