Paper/nms-patches/BlockLeaves.patch

25 lines
820 B
Diff
Raw Normal View History

@@ -2,6 +2,8 @@
import java.util.Random;
+import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
+
public abstract class BlockLeaves extends BlockTransparent {
public static final BlockStateBoolean DECAYABLE = BlockStateBoolean.of("decayable");
@@ -128,6 +130,14 @@
}
private void d(World world, BlockPosition blockposition) {
+ // CraftBukkit start
+ LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ world.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
this.b(world, blockposition, world.getType(blockposition), 0);
world.setAir(blockposition);
}