Archiviert
13
0

SPIGOT-2397: More calls to VehicleEntityCollisionEvent

Dieser Commit ist enthalten in:
md_5 2016-06-12 10:45:03 +10:00
Ursprung e2ff10bdcd
Commit f642d4bcc3

Datei anzeigen

@ -122,7 +122,7 @@
if (this.v() == EntityMinecartAbstract.EnumMinecartType.RIDEABLE && this.motX * this.motX + this.motZ * this.motZ > 0.01D) { 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)); 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); Entity entity = (Entity) list.get(l);
if (!(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && !(entity instanceof EntityMinecartAbstract) && !this.isVehicle() && !entity.isPassenger()) { if (!(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && !(entity instanceof EntityMinecartAbstract) && !this.isVehicle() && !entity.isPassenger()) {
@ -136,8 +136,33 @@
+ // CraftBukkit end + // CraftBukkit end
entity.startRiding(this); entity.startRiding(this);
} else { } 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); 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() { protected double o() {
@ -146,7 +171,7 @@
} }
public void a(int i, int j, int k, boolean flag) {} 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.motX = MathHelper.a(this.motX, -d0, d0);
this.motZ = MathHelper.a(this.motZ, -d0, d0); this.motZ = MathHelper.a(this.motZ, -d0, d0);
if (this.onGround) { if (this.onGround) {
@ -173,7 +198,7 @@
} }
} }
@@ -509,7 +585,7 @@ @@ -509,7 +601,7 @@
} }
protected void r() { protected void r() {
@ -182,7 +207,7 @@
this.motX *= 0.996999979019165D; this.motX *= 0.996999979019165D;
this.motY *= 0.0D; this.motY *= 0.0D;
this.motZ *= 0.996999979019165D; this.motZ *= 0.996999979019165D;
@@ -854,4 +930,26 @@ @@ -854,4 +946,26 @@
} }
} }