From ec5a806136c8639f559b8dd6857f4aa885732545 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Sat, 16 Nov 2024 11:53:58 +0800 Subject: [PATCH] Fix fakeplayer resident (#375) --- patches/server/0010-Fakeplayer-support.patch | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/patches/server/0010-Fakeplayer-support.patch b/patches/server/0010-Fakeplayer-support.patch index 42371d38..ad25c942 100644 --- a/patches/server/0010-Fakeplayer-support.patch +++ b/patches/server/0010-Fakeplayer-support.patch @@ -270,7 +270,7 @@ index c396580a9cfd86ff261bed439bb4662ae88010b5..c2263ef7fb67db7c01bac7aecf218ee8 PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld()); this.level().getCraftServer().getPluginManager().callEvent(changeEvent); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index d0190f633e99e2a5b5dc130def10c562ffc4e52e..31a55145bf2ed0e5a23fd07d1c14e93572d5ef5a 100644 +index 6bc129a8a71e8936d596fa2e585a259282d11622..ba5fd079be52e8d179029925777dad3db3de2433 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -123,6 +123,8 @@ import org.bukkit.event.player.PlayerRespawnEvent.RespawnReason; @@ -1638,10 +1638,10 @@ index 0000000000000000000000000000000000000000..4f5e6e5c1b9d8bd38c98e97fd31b3833 +} diff --git a/src/main/java/org/leavesmc/leaves/bot/BotList.java b/src/main/java/org/leavesmc/leaves/bot/BotList.java new file mode 100644 -index 0000000000000000000000000000000000000000..33deb7eeda2c4cda396ac4ed7f05e6a851e89050 +index 0000000000000000000000000000000000000000..bb33cad06036f188bd9228556fff6256391085c0 --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/bot/BotList.java -@@ -0,0 +1,339 @@ +@@ -0,0 +1,340 @@ +package org.leavesmc.leaves.bot; + +import com.google.common.collect.Maps; @@ -1924,8 +1924,9 @@ index 0000000000000000000000000000000000000000..33deb7eeda2c4cda396ac4ed7f05e6a8 + + public void loadResume() { + if (LeavesConfig.fakeplayerSupport && LeavesConfig.fakeplayerResident) { -+ for (String realName : this.getSavedBotList().getAllKeys()) { -+ CompoundTag nbt = this.getSavedBotList().getCompound(realName); ++ CompoundTag savedBotList = this.getSavedBotList().copy(); ++ for (String realName : savedBotList.getAllKeys()) { ++ CompoundTag nbt = savedBotList.getCompound(realName); + if (nbt.getBoolean("resume")) { + this.loadNewBot(realName); + }