diff options
author | Aikar <[email protected]> | 2018-10-12 01:38:32 -0400 |
---|---|---|
committer | Aikar <[email protected]> | 2018-10-12 01:38:32 -0400 |
commit | be4fc8c7af2ea2d586feed78dac022853cf0cf16 (patch) | |
tree | ac24d19d0a35e7950d9e1458200d277f2d66c2e7 /Spigot-Server-Patches/0367-Backport-the-dupe-uuid-and-entity-log-changes.patch | |
parent | 8601385dd760152f79a037d73f6fa44a0d407ae1 (diff) | |
download | Paper-be4fc8c7af2ea2d586feed78dac022853cf0cf16.tar.gz Paper-be4fc8c7af2ea2d586feed78dac022853cf0cf16.zip |
Backport the dupe uuid and entity log changes
Diffstat (limited to 'Spigot-Server-Patches/0367-Backport-the-dupe-uuid-and-entity-log-changes.patch')
-rw-r--r-- | Spigot-Server-Patches/0367-Backport-the-dupe-uuid-and-entity-log-changes.patch | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0367-Backport-the-dupe-uuid-and-entity-log-changes.patch b/Spigot-Server-Patches/0367-Backport-the-dupe-uuid-and-entity-log-changes.patch new file mode 100644 index 0000000000..ded65a7d54 --- /dev/null +++ b/Spigot-Server-Patches/0367-Backport-the-dupe-uuid-and-entity-log-changes.patch @@ -0,0 +1,144 @@ +From 11cf0fdfd5befaac8c2e5fbdb29a834a1dc69d1f Mon Sep 17 00:00:00 2001 +From: Aikar <[email protected]> +Date: Fri, 12 Oct 2018 01:37:54 -0400 +Subject: [PATCH] Backport the dupe uuid and entity log changes + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index ed14753512..ba299afc40 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -543,7 +543,7 @@ public class PaperWorldConfig { + } + + public enum DuplicateUUIDMode { +- SAFE_REGEN, REGEN, DELETE, NOTHING, WARN ++ SAFE_REGEN, DELETE, NOTHING, WARN + } + public DuplicateUUIDMode duplicateUUIDMode = DuplicateUUIDMode.SAFE_REGEN; + public int duplicateUUIDDeleteRange = 32; +@@ -553,13 +553,10 @@ public class PaperWorldConfig { + switch (desiredMode.toLowerCase()) { + case "saferegen": + case "saferegenerate": +- duplicateUUIDMode = DuplicateUUIDMode.SAFE_REGEN; +- log("Duplicate UUID Resolve: Safer Regenerate New UUID (Delete likely duplicates within " + duplicateUUIDDeleteRange + " blocks)"); +- break; + case "regen": + case "regenerate": +- duplicateUUIDMode = DuplicateUUIDMode.REGEN; +- log("Duplicate UUID Resolve: Regenerate New UUID"); ++ duplicateUUIDMode = DuplicateUUIDMode.SAFE_REGEN; ++ log("Duplicate UUID Resolve: Safer Regenerate New UUID (Delete likely duplicates within " + duplicateUUIDDeleteRange + " blocks)"); + break; + case "remove": + case "delete": +diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +index 6541f5af47..00c46fe50f 100644 +--- a/src/main/java/net/minecraft/server/Chunk.java ++++ b/src/main/java/net/minecraft/server/Chunk.java +@@ -888,7 +888,7 @@ public class Chunk { + List entityslice = aentityslice[j]; // Spigot + // Paper start + DuplicateUUIDMode mode = world.paperConfig.duplicateUUIDMode; +- if (mode == DuplicateUUIDMode.WARN || mode == DuplicateUUIDMode.DELETE || mode == DuplicateUUIDMode.REGEN || mode == DuplicateUUIDMode.SAFE_REGEN) { ++ if (mode == DuplicateUUIDMode.WARN || mode == DuplicateUUIDMode.DELETE || mode == DuplicateUUIDMode.SAFE_REGEN) { + Map<UUID, Entity> thisChunk = new HashMap<>(); + for (Iterator<Entity> iterator = ((List<Entity>) entityslice).iterator(); iterator.hasNext(); ) { + Entity entity = iterator.next(); +@@ -903,27 +903,26 @@ public class Chunk { + && java.util.Objects.equals(other.getSaveID(), entity.getSaveID()) + && entity.getBukkitEntity().getLocation().distance(other.getBukkitEntity().getLocation()) < world.paperConfig.duplicateUUIDDeleteRange + ) { +- logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + " because it was near the duplicate and likely an actual duplicate. See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); ++ if (World.DEBUG_ENTITIES) logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + " because it was near the duplicate and likely an actual duplicate. See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); + entity.die(); + iterator.remove(); + continue; + } + if (other != null && !other.dead) { + switch (mode) { +- case SAFE_REGEN: +- case REGEN: { ++ case SAFE_REGEN: { + entity.setUUID(UUID.randomUUID()); +- logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", regenerated UUID for " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); ++ if (World.DEBUG_ENTITIES) logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", regenerated UUID for " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); + break; + } + case DELETE: { +- logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); ++ if (World.DEBUG_ENTITIES) logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); + entity.die(); + iterator.remove(); + break; + } + default: +- logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", doing nothing to " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); ++ if (World.DEBUG_ENTITIES) logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", doing nothing to " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); + break; + } + } +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index bcbdadbd3a..7633a61342 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -45,6 +45,7 @@ public abstract class World implements IBlockAccess { + private int a = 63; + protected boolean d; + // Spigot start - guard entity list from removals ++ public static final boolean DEBUG_ENTITIES = Boolean.getBoolean("debug.entities"); // Paper + public final List<Entity> entityList = new java.util.ArrayList<Entity>() + { + @Override +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index b19942e0f1..d29420dd49 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -54,7 +54,6 @@ public class WorldServer extends World implements IAsyncTaskHandler { + private final List<NextTickListEntry> W = Lists.newArrayList(); + + // CraftBukkit start +- private static final boolean DEBUG_ENTITIES = Boolean.getBoolean("debug.entities"); // Paper + private static Throwable getAddToWorldStackTrace(Entity entity) { + return new Throwable(entity + " Added to world at " + new Date()); + } +@@ -1164,8 +1163,10 @@ public class WorldServer extends World implements IAsyncTaskHandler { + + private boolean j(Entity entity) { + if (entity.dead) { +- WorldServer.a.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.a(entity)); // CraftBukkit // Paper +- if (DEBUG_ENTITIES) getAddToWorldStackTrace(entity).printStackTrace(); ++ if (DEBUG_ENTITIES) { ++ WorldServer.a.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.a(entity)); // CraftBukkit // Paper ++ getAddToWorldStackTrace(entity).printStackTrace(); ++ } + return false; + } else { + UUID uuid = entity.getUniqueID(); +@@ -1178,9 +1179,10 @@ public class WorldServer extends World implements IAsyncTaskHandler { + } else { + if (!(entity instanceof EntityHuman)) { + if (entity.world.paperConfig.duplicateUUIDMode != com.destroystokyo.paper.PaperWorldConfig.DuplicateUUIDMode.NOTHING) { +- WorldServer.a.error("Keeping entity {} that already exists with UUID {}", entity1, uuid.toString()); // CraftBukkit // Paper +- WorldServer.a.error("Duplicate entity {} will not be added to the world. See paper.yml duplicate-uuid-resolver and set this to either regen, delete or nothing to get rid of this message", entity); // Paper + if (DEBUG_ENTITIES) { ++ WorldServer.a.error("Keeping entity {} that already exists with UUID {}", entity1, uuid.toString()); // CraftBukkit // Paper ++ WorldServer.a.error("Duplicate entity {} will not be added to the world. See paper.yml duplicate-uuid-resolver and set this to either regen, delete or nothing to get rid of this message", entity); // Paper ++ + if (entity1.addedToWorldStack != null) { + entity1.addedToWorldStack.printStackTrace(); + } +@@ -1211,8 +1213,8 @@ public class WorldServer extends World implements IAsyncTaskHandler { + Entity old = this.entitiesByUUID.put(entity.getUniqueID(), entity); + if (old != null && old.getId() != entity.getId() && old.valid && entity.world.paperConfig.duplicateUUIDMode != com.destroystokyo.paper.PaperWorldConfig.DuplicateUUIDMode.NOTHING) { + Logger logger = LogManager.getLogger(); +- logger.error("Overwrote an existing entity " + old + " with " + entity); + if (DEBUG_ENTITIES) { ++ logger.error("Overwrote an existing entity " + old + " with " + entity); + if (old.addedToWorldStack != null) { + old.addedToWorldStack.printStackTrace(); + } else { +-- +2.19.1 + |