SPIGOT-1927: Don't allow circular entity riding
Dieser Commit ist enthalten in:
Ursprung
feb2fd5e43
Commit
00d333414a
@ -372,11 +372,13 @@
|
||||
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack);
|
||||
|
||||
entityitem.q();
|
||||
@@ -1422,6 +1648,22 @@
|
||||
@@ -1422,6 +1648,24 @@
|
||||
if (entity.by() != this) {
|
||||
throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ com.google.common.base.Preconditions.checkState(!entity.passengers.contains(this), "Circular entity riding! %s %s", this, entity);
|
||||
+
|
||||
+ CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle();
|
||||
+ Entity orig = craft == null ? null : craft.getHandle();
|
||||
+ if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
|
||||
@ -395,7 +397,7 @@
|
||||
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bt() instanceof EntityHuman)) {
|
||||
this.passengers.add(0, entity);
|
||||
} else {
|
||||
@@ -1435,6 +1677,22 @@
|
||||
@@ -1435,6 +1679,22 @@
|
||||
if (entity.by() == this) {
|
||||
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
|
||||
} else {
|
||||
@ -418,7 +420,7 @@
|
||||
this.passengers.remove(entity);
|
||||
entity.j = 60;
|
||||
}
|
||||
@@ -1577,10 +1835,38 @@
|
||||
@@ -1577,10 +1837,38 @@
|
||||
}
|
||||
|
||||
public void onLightningStrike(EntityLightning entitylightning) {
|
||||
@ -459,7 +461,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1715,19 +2001,67 @@
|
||||
@@ -1715,19 +2003,67 @@
|
||||
if (!this.world.isClientSide && !this.dead) {
|
||||
this.world.methodProfiler.a("changeDimension");
|
||||
MinecraftServer minecraftserver = this.h();
|
||||
@ -530,7 +532,7 @@
|
||||
BlockPosition blockposition;
|
||||
|
||||
if (i == 1) {
|
||||
@@ -1756,12 +2090,18 @@
|
||||
@@ -1756,12 +2092,18 @@
|
||||
blockposition = new BlockPosition(this);
|
||||
}
|
||||
|
||||
@ -550,7 +552,7 @@
|
||||
if (j == 1 && i == 1) {
|
||||
BlockPosition blockposition1 = worldserver1.q(worldserver1.getSpawn());
|
||||
|
||||
@@ -1769,6 +2109,7 @@
|
||||
@@ -1769,6 +2111,7 @@
|
||||
} else {
|
||||
entity.setPositionRotation(blockposition, entity.yaw, entity.pitch);
|
||||
}
|
||||
@ -558,7 +560,7 @@
|
||||
|
||||
boolean flag = entity.attachedToPlayer;
|
||||
|
||||
@@ -1776,6 +2117,14 @@
|
||||
@@ -1776,6 +2119,14 @@
|
||||
worldserver1.addEntity(entity);
|
||||
entity.attachedToPlayer = flag;
|
||||
worldserver1.entityJoinedWorld(entity, false);
|
||||
@ -573,7 +575,7 @@
|
||||
}
|
||||
|
||||
this.dead = true;
|
||||
@@ -1881,6 +2230,11 @@
|
||||
@@ -1881,6 +2232,11 @@
|
||||
}
|
||||
|
||||
public void setCustomName(String s) {
|
||||
@ -585,7 +587,7 @@
|
||||
this.datawatcher.set(Entity.az, s);
|
||||
}
|
||||
|
||||
@@ -1938,7 +2292,26 @@
|
||||
@@ -1938,7 +2294,26 @@
|
||||
}
|
||||
|
||||
public void a(AxisAlignedBB axisalignedbb) {
|
||||
@ -613,7 +615,7 @@
|
||||
}
|
||||
|
||||
public float getHeadHeight() {
|
||||
@@ -2110,7 +2483,7 @@
|
||||
@@ -2110,7 +2485,7 @@
|
||||
for (Iterator iterator = this.bu().iterator(); iterator.hasNext(); entity.a(oclass, set)) {
|
||||
entity = (Entity) iterator.next();
|
||||
if (oclass.isAssignableFrom(entity.getClass())) {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren