Paper/nms-patches/BlockPlant.patch
2015-03-04 09:48:58 +00:00

30 lines
1.2 KiB
Diff

--- /home/matt/mc-dev-private//net/minecraft/server/BlockPlant.java 2015-02-26 22:40:22.203608144 +0000
+++ src/main/java/net/minecraft/server/BlockPlant.java 2015-02-26 22:40:22.203608144 +0000
@@ -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);
}