summaryrefslogtreecommitdiffstats
path: root/nms-patches/BlockLeaves.patch
blob: badb970f7905524f8f7f6bf76d456303ca27361c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockLeaves.java	2014-11-28 11:22:55.714823168 +0000
+++ src/main/java/net/minecraft/server/BlockLeaves.java	2014-11-28 11:01:54.000000000 +0000
@@ -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);
     }