From bcb9bb64f0acdd50d1eb9a001a30e55ebb4234bf Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 20 Aug 2018 20:20:40 -0400
Subject: [PATCH] Fix some false positive warnings printing that shouldnt be

reduces some log spam
---
 .../Add-some-Debug-to-Chunk-Entity-slices.patch              | 4 ++--
 Spigot-Server-Patches/Duplicate-UUID-Resolve-Option.patch    | 5 +++--
 Spigot-Server-Patches/Entity-add-to-world-fixes.patch        | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/Spigot-Server-Patches/Add-some-Debug-to-Chunk-Entity-slices.patch b/Spigot-Server-Patches/Add-some-Debug-to-Chunk-Entity-slices.patch
index f60b161c86..846f5d5ccc 100644
--- a/Spigot-Server-Patches/Add-some-Debug-to-Chunk-Entity-slices.patch
+++ b/Spigot-Server-Patches/Add-some-Debug-to-Chunk-Entity-slices.patch
@@ -9,7 +9,7 @@ This should hopefully avoid duplicate entities ever being created
 if the entity was to end up in 2 different chunk slices
 
 diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
-index 195cde784b..82abe2a914 100644
+index ce66bb780d..2a5d1c90b4 100644
 --- a/src/main/java/net/minecraft/server/Chunk.java
 +++ b/src/main/java/net/minecraft/server/Chunk.java
 @@ -0,0 +0,0 @@ public class Chunk {
@@ -52,7 +52,7 @@ index 195cde784b..82abe2a914 100644
          }
  
          // Paper start
-+        if (entitySlices[i] == entity.entitySlice) {
++        if (entity.entitySlice == null || !entity.entitySlice.contains(entity) || entitySlices[i] == entity.entitySlice) {
 +            entity.entitySlice = null;
 +        } else {
 +            LogManager.getLogger().warn(entity + " was removed from a entitySlice we did not expect. Report this to https://github.com/PaperMC/Paper/issues/1302");
diff --git a/Spigot-Server-Patches/Duplicate-UUID-Resolve-Option.patch b/Spigot-Server-Patches/Duplicate-UUID-Resolve-Option.patch
index ce21e791be..6ef8ca480c 100644
--- a/Spigot-Server-Patches/Duplicate-UUID-Resolve-Option.patch
+++ b/Spigot-Server-Patches/Duplicate-UUID-Resolve-Option.patch
@@ -85,7 +85,7 @@ index 14c8edeffc..c3bd82692d 100644
 +    }
  }
 diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
-index 4757081090..3d5b6eabaf 100644
+index 4757081090..d29aec7149 100644
 --- a/src/main/java/net/minecraft/server/Chunk.java
 +++ b/src/main/java/net/minecraft/server/Chunk.java
 @@ -0,0 +0,0 @@
@@ -138,6 +138,7 @@ index 4757081090..3d5b6eabaf 100644
 +                    ) {
 +                        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) {
@@ -179,7 +180,7 @@ index 7b856cad91..eb8904a728 100644
          this.uniqueID = uuid;
          this.ar = this.uniqueID.toString();
 diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
-index 5de8da65c0..c53e77b821 100644
+index d96126bcf2..5257db1e00 100644
 --- a/src/main/java/net/minecraft/server/World.java
 +++ b/src/main/java/net/minecraft/server/World.java
 @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
diff --git a/Spigot-Server-Patches/Entity-add-to-world-fixes.patch b/Spigot-Server-Patches/Entity-add-to-world-fixes.patch
index 28e7f564e9..2a88cc4f3b 100644
--- a/Spigot-Server-Patches/Entity-add-to-world-fixes.patch
+++ b/Spigot-Server-Patches/Entity-add-to-world-fixes.patch
@@ -14,7 +14,7 @@ Fix this by differing entity add to world for all entities at the same time
 the original entity is dead, overwrite it as the logic does for unloaod queued entities.
 
 diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
-index 82abe2a914..f618e8f628 100644
+index 2a5d1c90b4..1d2673a7b3 100644
 --- a/src/main/java/net/minecraft/server/Chunk.java
 +++ b/src/main/java/net/minecraft/server/Chunk.java
 @@ -0,0 +0,0 @@ public class Chunk {