diff --git a/folia-server/minecraft-patches/features/0009-Fix-vanish-api-sync-error.patch b/folia-server/minecraft-patches/features/0009-Fix-vanish-api-sync-error.patch new file mode 100644 index 0000000000..e8df4d7e9f --- /dev/null +++ b/folia-server/minecraft-patches/features/0009-Fix-vanish-api-sync-error.patch @@ -0,0 +1,18 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Rothes <449181985@qq.com> +Date: Thu, 19 Mar 2026 10:12:55 +0800 +Subject: [PATCH] Fix vanish api sync error + + +diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java +index d94c0d15f62b67378669d4ce7252d99b8f743fa5..1574ead80189fbd4e4f6d677992f3ea5671bf844 100644 +--- a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java ++++ b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java +@@ -307,6 +307,7 @@ public final class RegionizedPlayerChunkLoader { + TickThread.ensureTickThread("Cannot tick player chunk loader async"); + long currTime = System.nanoTime(); + for (final ServerPlayer player : new java.util.ArrayList<>(this.world.getLocalPlayers())) { // Folia - region threding ++ player.getBukkitEntity().onTick(); // Folia - Fix vanish api sync error + final PlayerChunkLoaderData loader = ((ChunkSystemServerPlayer)player).moonrise$getChunkLoader(); + if (loader == null || loader.removed || loader.world != this.world) { + // not our problem anymore diff --git a/folia-server/paper-patches/features/0008-Fix-vanish-api-sync-error.patch b/folia-server/paper-patches/features/0008-Fix-vanish-api-sync-error.patch new file mode 100644 index 0000000000..214e2a32a9 --- /dev/null +++ b/folia-server/paper-patches/features/0008-Fix-vanish-api-sync-error.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Rothes <449181985@qq.com> +Date: Thu, 19 Mar 2026 10:12:55 +0800 +Subject: [PATCH] Fix vanish api sync error + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index 0d26a26d15de61031c6277e1671a3992dbf52f2d..df1618d425fd0906d702c2c3b11cfd3b40d1e1cf 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -248,6 +248,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player, PluginMessa + private long lastSaveTime; // Paper - getLastPlayed replacement API + private @Nullable CraftScoreboard scoreboardOverride; + public final net.minecraft.network.PacketProcessor packetProcessor = new net.minecraft.network.PacketProcessor(null); // Folia ++ private final java.util.concurrent.ConcurrentLinkedDeque removedEntities = new java.util.concurrent.ConcurrentLinkedDeque<>(); // Folia - Fix vanish api sync error + + // Folia start - region threading + // used only to notify tasks for packets +@@ -2086,9 +2087,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player, PluginMessa + // Paper end + + public void onEntityRemove(Entity entity) { +- this.invertedVisibilityEntities.remove(entity.getUUID()); ++ // Folia start - Fix vanish api sync error ++ if (this.invertedVisibilityEntities.isEmpty()) return; // Nothing hidden ++ this.removedEntities.add(entity.getUUID()); + } + ++ public void onTick() { ++ java.util.UUID item; ++ while ((item = this.removedEntities.poll()) != null) { ++ this.invertedVisibilityEntities.remove(item); ++ } ++ } ++ // Folia end - Fix vanish api sync error ++ + @Override + public boolean canSee(Player player) { + return this.canSee((org.bukkit.entity.Entity) player);