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)) {
|
if (!flag && this.world.getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) {
|
||||||
this.a((IMaterial) this.f());
|
this.a((IMaterial) this.f());
|
||||||
}
|
}
|
||||||
@@ -140,9 +179,25 @@
|
@@ -140,9 +179,29 @@
|
||||||
public void collide(Entity entity) {
|
public void collide(Entity entity) {
|
||||||
if (entity instanceof EntityBoat) {
|
if (entity instanceof EntityBoat) {
|
||||||
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
|
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
|
+ if (!this.isSameVehicle(entity)) {
|
||||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
+ VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
|
||||||
|
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||||
+
|
+
|
||||||
+ if (event.isCancelled()) {
|
+ if (event.isCancelled()) {
|
||||||
+ return;
|
+ return;
|
||||||
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
}
|
}
|
||||||
} else if (entity.getBoundingBox().minY <= this.getBoundingBox().minY) {
|
} else if (entity.getBoundingBox().minY <= this.getBoundingBox().minY) {
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
|
+ if (!this.isSameVehicle(entity)) {
|
||||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
+ VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
|
||||||
|
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||||
+
|
+
|
||||||
+ if (event.isCancelled()) {
|
+ if (event.isCancelled()) {
|
||||||
+ return;
|
+ return;
|
||||||
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,6 +231,7 @@
|
@@ -176,6 +235,7 @@
|
||||||
return this.getDirection().f();
|
return this.getDirection().f();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +105,7 @@
|
|||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
this.aG = this.aF;
|
this.aG = this.aF;
|
||||||
@@ -216,6 +272,22 @@
|
@@ -216,6 +276,22 @@
|
||||||
this.setMot(Vec3D.a);
|
this.setMot(Vec3D.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +128,7 @@
|
|||||||
this.q();
|
this.q();
|
||||||
|
|
||||||
for (int i = 0; i <= 1; ++i) {
|
for (int i = 0; i <= 1; ++i) {
|
||||||
@@ -734,6 +806,11 @@
|
@@ -734,6 +810,11 @@
|
||||||
|
|
||||||
this.b(this.fallDistance, 1.0F);
|
this.b(this.fallDistance, 1.0F);
|
||||||
if (!this.world.isClientSide && !this.dead) {
|
if (!this.world.isClientSide && !this.dead) {
|
||||||
@ -136,7 +140,7 @@
|
|||||||
this.die();
|
this.die();
|
||||||
if (this.world.getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) {
|
if (this.world.getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) {
|
||||||
int i;
|
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) {
|
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));
|
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);
|
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()) {
|
||||||
@ -137,17 +137,19 @@
|
|||||||
entity.startRiding(this);
|
entity.startRiding(this);
|
||||||
} else {
|
} else {
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, entity.getBukkitEntity());
|
+ if (!this.isSameVehicle(entity)) {
|
||||||
+ this.world.getServer().getPluginManager().callEvent(collisionEvent);
|
+ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, entity.getBukkitEntity());
|
||||||
|
+ this.world.getServer().getPluginManager().callEvent(collisionEvent);
|
||||||
+
|
+
|
||||||
+ if (collisionEvent.isCancelled()) {
|
+ if (collisionEvent.isCancelled()) {
|
||||||
+ continue;
|
+ continue;
|
||||||
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
entity.collide(this);
|
entity.collide(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -248,6 +326,14 @@
|
@@ -248,6 +328,14 @@
|
||||||
Entity entity1 = (Entity) iterator.next();
|
Entity entity1 = (Entity) iterator.next();
|
||||||
|
|
||||||
if (!this.w(entity1) && entity1.isCollidable() && entity1 instanceof EntityMinecartAbstract) {
|
if (!this.w(entity1) && entity1.isCollidable() && entity1 instanceof EntityMinecartAbstract) {
|
||||||
@ -162,7 +164,7 @@
|
|||||||
entity1.collide(this);
|
entity1.collide(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -258,7 +344,7 @@
|
@@ -258,7 +346,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected double getMaxSpeed() {
|
protected double getMaxSpeed() {
|
||||||
@ -171,7 +173,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(int i, int j, int k, boolean flag) {}
|
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));
|
this.setMot(MathHelper.a(vec3d.x, -d0, d0), vec3d.y, MathHelper.a(vec3d.z, -d0, d0));
|
||||||
if (this.onGround) {
|
if (this.onGround) {
|
||||||
@ -190,7 +192,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -461,7 +551,7 @@
|
@@ -461,7 +553,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void decelerate() {
|
protected void decelerate() {
|
||||||
@ -199,7 +201,7 @@
|
|||||||
|
|
||||||
this.setMot(this.getMot().d(d0, 0.0D, d0));
|
this.setMot(this.getMot().d(d0, 0.0D, d0));
|
||||||
}
|
}
|
||||||
@@ -544,6 +634,14 @@
|
@@ -544,6 +636,14 @@
|
||||||
if (!this.world.isClientSide) {
|
if (!this.world.isClientSide) {
|
||||||
if (!entity.noclip && !this.noclip) {
|
if (!entity.noclip && !this.noclip) {
|
||||||
if (!this.w(entity)) {
|
if (!this.w(entity)) {
|
||||||
@ -214,7 +216,7 @@
|
|||||||
double d0 = entity.locX() - this.locX();
|
double d0 = entity.locX() - this.locX();
|
||||||
double d1 = entity.locZ() - this.locZ();
|
double d1 = entity.locZ() - this.locZ();
|
||||||
double d2 = d0 * d0 + d1 * d1;
|
double d2 = d0 * d0 + d1 * d1;
|
||||||
@@ -679,4 +777,26 @@
|
@@ -679,4 +779,26 @@
|
||||||
|
|
||||||
private EnumMinecartType() {}
|
private EnumMinecartType() {}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren