From 8a917b49f4521e494a7ff77df08607d663c8a7ca Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 10 Jan 2021 18:36:38 +0000
Subject: [PATCH] clone POI blockpos before dispatching

---
 Spigot-Server-Patches/Remove-stale-POIs.patch | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/Spigot-Server-Patches/Remove-stale-POIs.patch b/Spigot-Server-Patches/Remove-stale-POIs.patch
index bdaea55de6..6e4bb70ae1 100644
--- a/Spigot-Server-Patches/Remove-stale-POIs.patch
+++ b/Spigot-Server-Patches/Remove-stale-POIs.patch
@@ -33,15 +33,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          Optional<VillagePlaceType> optional1 = VillagePlaceType.b(iblockdata1);
  
 +        // Paper start
++        BlockPosition blockposition1 = blockposition.immutableCopy();
 +        this.getMinecraftServer().execute(() -> {
-+                if (!optional.isPresent() && this.getPoiStorage().test(blockposition, com.google.common.base.Predicates.alwaysTrue())) {
-+                    this.getPoiStorage().remove(blockposition);
++                if (!optional.isPresent() && this.getPoiStorage().test(blockposition1, com.google.common.base.Predicates.alwaysTrue())) {
++                    this.getPoiStorage().remove(blockposition1);
 +                }
 +        });
-+        // Paper end
          if (!Objects.equals(optional, optional1)) {
-             BlockPosition blockposition1 = blockposition.immutableCopy();
+-            BlockPosition blockposition1 = blockposition.immutableCopy();
++            //BlockPosition blockposition1 = blockposition.immutableCopy();
++            // Paper end
  
+             optional.ifPresent((villageplacetype) -> {
+                 this.getMinecraftServer().execute(() -> {
 @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
          }
      }