Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ private void callAndRemove(Block block, Event bukkitEvent) {
public void onBreak(BlockBreakEvent event) {
callAndRemove(event);
}

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPhysics(BlockPhysicsEvent event) {
// event.getBlock().getType() returns air when the block is broken
if(event.getBlock().getType() == Material.AIR) {
callAndRemove(event.getBlock(), event);
}
}

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlace(BlockPlaceEvent event) {
Expand Down Expand Up @@ -142,6 +150,10 @@ public void onPiston(BlockPistonExtendEvent event) {

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPiston(BlockPistonRetractEvent event) {
Block pistonHead = event.getBlock().getRelative(event.getDirection().getOppositeFace());
if(CustomBlockData.hasCustomBlockData(pistonHead, plugin)) {
callAndRemove(pistonHead);
}
onPiston(event.getBlocks(), event);
}

Expand Down