mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 20:21:51 +01:00
2f34301581
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: 7361a62e SPIGOT-5641: Add Block.getDrops(ItemStack, Entity) 1dc91b15 Add specific notes about what is not API 2b05ef88 #484: Allow statistics to be accessed for offline players CraftBukkit Changes:f7d6ad53
SPIGOT-5603: Use LootContext#lootingModifier in CraftLootTable5838285d
SPIGOT-5657: BlockPlaceEvent not cancelling for tripwire hooksf325b9be
SPIGOT-5641: Add Block.getDrops(ItemStack, Entity)e25a2272
Fix some formatting in CraftHumanEntity498540e0
Add Merchant slot delegateb2de47d5
SPIGOT-5621: Add missing container types for opening InventoryViewaa3a2f27
#645: Allow statistics to be accessed for offline players2122c0b1
#649: CraftBell should implement Bell
51 lines
2.8 KiB
Diff
51 lines
2.8 KiB
Diff
From 962e7da640e2e9a75a8c83908019edddcae3829b 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 0186ab9e40..e1e4ea793a 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
|
@@ -1484,6 +1484,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)) {
|
|
if (!(entity instanceof EntityLightning)) {
|
|
EntityTypes<?> entitytypes = entity.getEntityType();
|
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
|
index 941eee838b..c7ec8cbc11 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -1449,7 +1449,7 @@ public class WorldServer extends World {
|
|
}
|
|
}
|
|
|
|
- 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);
|
|
@@ -1460,6 +1460,7 @@ public class WorldServer extends World {
|
|
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();
|
|
--
|
|
2.25.1
|
|
|