SPIGOT-6186: Canceling a CreatureSpawnEvent​ results in a "Unable to summon entity due to duplicate UUIDs" error

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2020-11-17 13:41:47 +11:00
parent 889488ff73
commit 658c0a284a
4 changed files with 30 additions and 30 deletions

View File

@@ -395,7 +395,7 @@
return true;
}
}
@@ -813,11 +954,16 @@
@@ -813,10 +954,16 @@
}
public boolean addAllEntitiesSafely(Entity entity) {
@@ -409,12 +409,11 @@
return false;
} else {
- this.addAllEntities(entity);
- return true;
+ return this.addAllEntities(entity, reason); // CraftBukkit
+ this.addAllEntities(entity, reason); // CraftBukkit
return true;
}
}
@@ -867,10 +1013,17 @@
@@ -867,10 +1014,17 @@
}
this.getScoreboard().a(entity);
@@ -432,7 +431,7 @@
}
private void registerEntity(Entity entity) {
@@ -891,9 +1044,16 @@
@@ -891,9 +1045,16 @@
this.entitiesByUUID.put(entity.getUniqueID(), entity);
this.getChunkProvider().addEntity(entity);
@@ -449,7 +448,7 @@
}
}
@@ -923,10 +1083,33 @@
@@ -923,10 +1084,33 @@
this.everyoneSleeping();
}
@@ -483,7 +482,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -935,6 +1118,12 @@
@@ -935,6 +1119,12 @@
double d1 = (double) blockposition.getY() - entityplayer.locY();
double d2 = (double) blockposition.getZ() - entityplayer.locZ();
@@ -496,7 +495,7 @@
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
}
@@ -995,10 +1184,20 @@
@@ -995,10 +1185,20 @@
@Override
public Explosion createExplosion(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) {
@@ -517,7 +516,7 @@
if (explosion_effect == Explosion.Effect.NONE) {
explosion.clearBlocks();
}
@@ -1063,13 +1262,20 @@
@@ -1063,13 +1263,20 @@
}
public <T extends ParticleParam> int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
@@ -540,7 +539,7 @@
++j;
}
}
@@ -1111,7 +1317,7 @@
@@ -1111,7 +1318,7 @@
@Nullable
public BlockPosition a(StructureGenerator<?> structuregenerator, BlockPosition blockposition, int i, boolean flag) {
@@ -549,7 +548,7 @@
}
@Nullable
@@ -1149,7 +1355,13 @@
@@ -1149,7 +1356,13 @@
@Override
public WorldMap a(String s) {
return (WorldMap) this.getMinecraftServer().E().getWorldPersistentData().b(() -> {
@@ -564,7 +563,7 @@
}, s);
}
@@ -1460,6 +1672,11 @@
@@ -1460,6 +1673,11 @@
@Override
public void update(BlockPosition blockposition, Block block) {
if (!this.isDebugWorld()) {
@@ -576,7 +575,7 @@
this.applyPhysics(blockposition, block);
}
@@ -1474,12 +1691,12 @@
@@ -1474,12 +1692,12 @@
}
public boolean isFlatWorld() {
@@ -591,7 +590,7 @@
}
@Nullable
@@ -1499,9 +1716,9 @@
@@ -1499,9 +1717,9 @@
@VisibleForTesting
public String F() {
@@ -603,7 +602,7 @@
return IRegistry.BLOCK_ENTITY_TYPE.getKey(tileentity.getTileType());
}), this.getBlockTickList().a(), this.getFluidTickList().a(), this.P());
}
@@ -1509,7 +1726,7 @@
@@ -1509,7 +1727,7 @@
private static <T> String a(Collection<T> collection, Function<T, MinecraftKey> function) {
try {
Object2IntOpenHashMap<MinecraftKey> object2intopenhashmap = new Object2IntOpenHashMap();
@@ -612,7 +611,7 @@
while (iterator.hasNext()) {
T t0 = iterator.next();
@@ -1518,7 +1735,8 @@
@@ -1518,7 +1736,8 @@
object2intopenhashmap.addTo(minecraftkey, 1);
}
@@ -622,7 +621,7 @@
return it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey() + ":" + it_unimi_dsi_fastutil_objects_object2intmap_entry.getIntValue();
}).collect(Collectors.joining(","));
} catch (Exception exception) {
@@ -1527,16 +1745,32 @@
@@ -1527,16 +1746,32 @@
}
public static void a(WorldServer worldserver) {