summaryrefslogtreecommitdiffstats
path: root/nms-patches
diff options
context:
space:
mode:
authorBlackHole <black-hole@live.com>2017-05-01 01:21:20 +0200
committermd_5 <git@md-5.net>2017-05-01 19:49:37 +1000
commitfbb47e83831c8a9b0faf0a01855537ca57cdecef (patch)
tree5052dc696d45792de0fa9b0ea078bbac3e771ebb /nms-patches
parentfecf4b4137c5ce01fb18b697da244a6753b35c2b (diff)
downloadcraftbukkit-fbb47e83831c8a9b0faf0a01855537ca57cdecef.tar
craftbukkit-fbb47e83831c8a9b0faf0a01855537ca57cdecef.tar.gz
craftbukkit-fbb47e83831c8a9b0faf0a01855537ca57cdecef.tar.lz
craftbukkit-fbb47e83831c8a9b0faf0a01855537ca57cdecef.tar.xz
craftbukkit-fbb47e83831c8a9b0faf0a01855537ca57cdecef.zip
SPIGOT-3215: Call BlockPhysicsEvent for tall plants
Diffstat (limited to 'nms-patches')
-rw-r--r--nms-patches/BlockPlant.patch21
-rw-r--r--nms-patches/BlockTallPlant.patch14
2 files changed, 17 insertions, 18 deletions
diff --git a/nms-patches/BlockPlant.patch b/nms-patches/BlockPlant.patch
index ff1d2de5..c9ac5dc7 100644
--- a/nms-patches/BlockPlant.patch
+++ b/nms-patches/BlockPlant.patch
@@ -1,26 +1,11 @@
--- a/net/minecraft/server/BlockPlant.java
+++ b/net/minecraft/server/BlockPlant.java
-@@ -2,6 +2,10 @@
-
- import java.util.Random;
- import javax.annotation.Nullable;
-+// 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 @@
+@@ -40,6 +40,11 @@
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()) {
++ // CraftBukkit start
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
diff --git a/nms-patches/BlockTallPlant.patch b/nms-patches/BlockTallPlant.patch
new file mode 100644
index 00000000..a1127a3a
--- /dev/null
+++ b/nms-patches/BlockTallPlant.patch
@@ -0,0 +1,14 @@
+--- a/net/minecraft/server/BlockTallPlant.java
++++ b/net/minecraft/server/BlockTallPlant.java
+@@ -48,6 +48,11 @@
+
+ protected void e(World world, BlockPosition blockposition, IBlockData iblockdata) {
+ if (!this.f(world, blockposition, iblockdata)) {
++ // CraftBukkit start
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) {
++ return;
++ }
++ // CraftBukkit end
+ boolean flag = iblockdata.get(BlockTallPlant.HALF) == BlockTallPlant.EnumTallPlantHalf.UPPER;
+ BlockPosition blockposition1 = flag ? blockposition : blockposition.up();
+ BlockPosition blockposition2 = flag ? blockposition.down() : blockposition;