mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-15 07:05:44 +01:00
899bc53b79
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: f47abd88 SPIGOT-6242: Fix some file line endings de96535b SPIGOT-6234: enum classes don't serialize properly when implementing ConfigurationSerializable CraftBukkit Changes: 4475707d SPIGOT-6244: /spawnpoint ignores angle 8b3b096d SPIGOT-6242: Fix some file line endings 4b33c749 SPIGOT-6186: Canceling a CreatureSpawnEvent results in a "Unable to summon entity due to duplicate UUIDs" error 2b3ca726 SPIGOT-6236: Vehicle passenger portal cooldown does not change
49 lines
2.9 KiB
Diff
49 lines
2.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Thu, 2 Apr 2020 01:42:39 -0400
|
|
Subject: [PATCH] Prevent Double PlayerChunkMap adds crashing server
|
|
|
|
Suspected case would be around the technique used in .stopRiding
|
|
Stack will identify any causer of this and warn instead of crashing.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
|
index 512940ef8608d28c83a4a8d0777a99ebf25b4e8b..f839091ae4385e763a19d680585a9363fad6b744 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
|
@@ -1446,6 +1446,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
|
|
|
protected void addEntity(Entity entity) {
|
|
org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot
|
|
+ // Paper start - ignore and warn about illegal addEntity calls instead of crashing server
|
|
+ if (!entity.valid || entity.world != this.world || this.trackedEntities.containsKey(entity.getId())) {
|
|
+ new Throwable("[ERROR] Illegal PlayerChunkMap::addEntity for world " + this.world.getWorld().getName()
|
|
+ + ": " + entity + (this.trackedEntities.containsKey(entity.getId()) ? " ALREADY CONTAINED (This would have crashed your server)" : ""))
|
|
+ .printStackTrace();
|
|
+ return;
|
|
+ }
|
|
+ // Paper end
|
|
if (!(entity instanceof EntityComplexPart)) {
|
|
EntityTypes<?> entitytypes = entity.getEntityType();
|
|
int i = entitytypes.getChunkRange() * 16;
|
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
|
index 5cb27e78ec27b131ea2790bb0aceca5b27fbf5b6..ed13a1bc54cebebbafbf9a3822d2942fbc09249e 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -1417,7 +1417,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
|
}
|
|
}
|
|
|
|
- this.getChunkProvider().addEntity(entity);
|
|
+ // this.getChunkProvider().addEntity(entity); // Paper - moved down below valid=true
|
|
// CraftBukkit start - SPIGOT-5278
|
|
if (entity instanceof EntityDrowned) {
|
|
this.navigators.add(((EntityDrowned) entity).navigationWater);
|
|
@@ -1428,6 +1428,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
|
this.navigators.add(((EntityInsentient) entity).getNavigation());
|
|
}
|
|
entity.valid = true; // CraftBukkit
|
|
+ this.getChunkProvider().addEntity(entity); // Paper - from above to be below valid=true
|
|
// Paper start - Set origin location when the entity is being added to the world
|
|
if (entity.origin == null) {
|
|
entity.origin = entity.getBukkitEntity().getLocation();
|