SPIGOT-5514: VehicleEntityCollisionEvent triggered by passengers
Dieser Commit ist enthalten in:
Ursprung
a0e88fb362
Commit
596b0b2d07
@ -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 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +122,7 @@
|
||||
if (this.getMinecartType() == EntityMinecartAbstract.EnumMinecartType.RIDEABLE && b(this.getMot()) > 0.01D) {
|
||||
List<Entity> list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D), IEntitySelector.a(this));
|
||||
|
||||
@@ -235,8 +297,24 @@
|
||||
@@ -235,8 +297,26 @@
|
||||
Entity entity = (Entity) list.get(l);
|
||||
|
||||
if (!(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && !(entity instanceof EntityMinecartAbstract) && !this.isVehicle() && !entity.isPassenger()) {
|
||||
@ -137,17 +137,19 @@
|
||||
entity.startRiding(this);
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, entity.getBukkitEntity());
|
||||
+ this.world.getServer().getPluginManager().callEvent(collisionEvent);
|
||||
+ if (!this.isSameVehicle(entity)) {
|
||||
+ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, entity.getBukkitEntity());
|
||||
+ this.world.getServer().getPluginManager().callEvent(collisionEvent);
|
||||
+
|
||||
+ if (collisionEvent.isCancelled()) {
|
||||
+ continue;
|
||||
+ if (collisionEvent.isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entity.collide(this);
|
||||
}
|
||||
}
|
||||
@@ -248,6 +326,14 @@
|
||||
@@ -248,6 +328,14 @@
|
||||
Entity entity1 = (Entity) iterator.next();
|
||||
|
||||
if (!this.w(entity1) && entity1.isCollidable() && entity1 instanceof EntityMinecartAbstract) {
|
||||
@ -162,7 +164,7 @@
|
||||
entity1.collide(this);
|
||||
}
|
||||
}
|
||||
@@ -258,7 +344,7 @@
|
||||
@@ -258,7 +346,7 @@
|
||||
}
|
||||
|
||||
protected double getMaxSpeed() {
|
||||
@ -171,7 +173,7 @@
|
||||
}
|
||||
|
||||
public void a(int i, int j, int k, boolean flag) {}
|
||||
@@ -269,12 +355,16 @@
|
||||
@@ -269,12 +357,16 @@
|
||||
|
||||
this.setMot(MathHelper.a(vec3d.x, -d0, d0), vec3d.y, MathHelper.a(vec3d.z, -d0, d0));
|
||||
if (this.onGround) {
|
||||
@ -190,7 +192,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -461,7 +551,7 @@
|
||||
@@ -461,7 +553,7 @@
|
||||
}
|
||||
|
||||
protected void decelerate() {
|
||||
@ -199,7 +201,7 @@
|
||||
|
||||
this.setMot(this.getMot().d(d0, 0.0D, d0));
|
||||
}
|
||||
@@ -544,6 +634,14 @@
|
||||
@@ -544,6 +636,14 @@
|
||||
if (!this.world.isClientSide) {
|
||||
if (!entity.noclip && !this.noclip) {
|
||||
if (!this.w(entity)) {
|
||||
@ -214,7 +216,7 @@
|
||||
double d0 = entity.locX() - this.locX();
|
||||
double d1 = entity.locZ() - this.locZ();
|
||||
double d2 = d0 * d0 + d1 * d1;
|
||||
@@ -679,4 +777,26 @@
|
||||
@@ -679,4 +779,26 @@
|
||||
|
||||
private EnumMinecartType() {}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren