From f642d4bcc3ee5a6e29876a213544f4502cfc863c Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 12 Jun 2016 10:45:03 +1000 Subject: [PATCH] SPIGOT-2397: More calls to VehicleEntityCollisionEvent --- nms-patches/EntityMinecartAbstract.patch | 35 ++++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/nms-patches/EntityMinecartAbstract.patch b/nms-patches/EntityMinecartAbstract.patch index 835b05a38a..7075019165 100644 --- a/nms-patches/EntityMinecartAbstract.patch +++ b/nms-patches/EntityMinecartAbstract.patch @@ -122,7 +122,7 @@ if (this.v() == EntityMinecartAbstract.EnumMinecartType.RIDEABLE && this.motX * this.motX + this.motZ * this.motZ > 0.01D) { List list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D), IEntitySelector.a(this)); -@@ -278,6 +342,14 @@ +@@ -278,8 +342,24 @@ Entity entity = (Entity) list.get(l); if (!(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && !(entity instanceof EntityMinecartAbstract) && !this.isVehicle() && !entity.isPassenger()) { @@ -136,8 +136,33 @@ + // CraftBukkit end entity.startRiding(this); } else { ++ // CraftBukkit start ++ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, entity.getBukkitEntity()); ++ this.world.getServer().getPluginManager().callEvent(collisionEvent); ++ ++ if (collisionEvent.isCancelled()) { ++ continue; ++ } ++ // CraftBukkit end entity.collide(this); -@@ -301,7 +373,7 @@ + } + } +@@ -291,6 +371,14 @@ + Entity entity1 = (Entity) iterator.next(); + + if (!this.w(entity1) && entity1.isCollidable() && entity1 instanceof EntityMinecartAbstract) { ++ // CraftBukkit start ++ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, entity1.getBukkitEntity()); ++ this.world.getServer().getPluginManager().callEvent(collisionEvent); ++ ++ if (collisionEvent.isCancelled()) { ++ continue; ++ } ++ // CraftBukkit end + entity1.collide(this); + } + } +@@ -301,7 +389,7 @@ } protected double o() { @@ -146,7 +171,7 @@ } public void a(int i, int j, int k, boolean flag) {} -@@ -312,16 +384,20 @@ +@@ -312,16 +400,20 @@ this.motX = MathHelper.a(this.motX, -d0, d0); this.motZ = MathHelper.a(this.motZ, -d0, d0); if (this.onGround) { @@ -173,7 +198,7 @@ } } -@@ -509,7 +585,7 @@ +@@ -509,7 +601,7 @@ } protected void r() { @@ -182,7 +207,7 @@ this.motX *= 0.996999979019165D; this.motY *= 0.0D; this.motZ *= 0.996999979019165D; -@@ -854,4 +930,26 @@ +@@ -854,4 +946,26 @@ } }