summaryrefslogtreecommitdiffstats
path: root/nms-patches/BlockPlant.patch
blob: 29fb3af8167e6df868761a5c7c8a6f4c0a3dbf89 (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
27
28
29
--- a/net/minecraft/server/BlockPlant.java
+++ b/net/minecraft/server/BlockPlant.java
@@ -1,6 +1,10 @@
 package net.minecraft.server;
 
 import java.util.Random;
+// CraftBukkit start
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
+import org.bukkit.event.block.BlockPhysicsEvent;
+// CraftBukkit end
 
 public class BlockPlant extends Block {
 
@@ -40,6 +44,15 @@
 
     protected void e(World world, BlockPosition blockposition, IBlockData iblockdata) {
         if (!this.f(world, blockposition, iblockdata)) {
+            // CraftBukkit Start
+            org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+            BlockPhysicsEvent event = new BlockPhysicsEvent(block, block.getTypeId());
+            world.getServer().getPluginManager().callEvent(event);
+
+            if (event.isCancelled()) {
+                return;
+            }
+            // CraftBukkit end
             this.b(world, blockposition, iblockdata, 0);
             world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3);
         }