SPIGOT-5514: VehicleEntityCollisionEvent triggered by passengers
By: Lars Dormans <lars.dormans@live.nl>
This commit is contained in:
@@ -67,33 +67,37 @@
|
||||
if (!flag && this.world.getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) {
|
||||
this.a((IMaterial) this.f());
|
||||
}
|
||||
@@ -140,9 +179,25 @@
|
||||
@@ -140,9 +179,29 @@
|
||||
public void collide(Entity entity) {
|
||||
if (entity instanceof EntityBoat) {
|
||||
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
|
||||
+ // CraftBukkit start
|
||||
+ VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+ if (!this.isSameVehicle(entity)) {
|
||||
+ VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
super.collide(entity);
|
||||
}
|
||||
} else if (entity.getBoundingBox().minY <= this.getBoundingBox().minY) {
|
||||
+ // CraftBukkit start
|
||||
+ VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+ if (!this.isSameVehicle(entity)) {
|
||||
+ VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
super.collide(entity);
|
||||
}
|
||||
|
||||
@@ -176,6 +231,7 @@
|
||||
@@ -176,6 +235,7 @@
|
||||
return this.getDirection().f();
|
||||
}
|
||||
|
||||
@@ -101,7 +105,7 @@
|
||||
@Override
|
||||
public void tick() {
|
||||
this.aG = this.aF;
|
||||
@@ -216,6 +272,22 @@
|
||||
@@ -216,6 +276,22 @@
|
||||
this.setMot(Vec3D.a);
|
||||
}
|
||||
|
||||
@@ -124,7 +128,7 @@
|
||||
this.q();
|
||||
|
||||
for (int i = 0; i <= 1; ++i) {
|
||||
@@ -734,6 +806,11 @@
|
||||
@@ -734,6 +810,11 @@
|
||||
|
||||
this.b(this.fallDistance, 1.0F);
|
||||
if (!this.world.isClientSide && !this.dead) {
|
||||
@@ -136,7 +140,7 @@
|
||||
this.die();
|
||||
if (this.world.getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) {
|
||||
int i;
|
||||
@@ -747,6 +824,7 @@
|
||||
@@ -747,6 +828,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user