aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0430-Fix-client-lag-on-advancement-loading.patch
diff options
context:
space:
mode:
authorSpottedleaf <[email protected]>2024-07-17 10:24:53 -0700
committerSpottedleaf <[email protected]>2024-07-17 10:28:32 -0700
commit00b949f1bbbf444e2b5e7b8de7c9b14fbd2133c6 (patch)
tree82639515bc5e9ae00c1e639e72137ed51e1ac688 /patches/server/0430-Fix-client-lag-on-advancement-loading.patch
parent967f98aa81da851740aeb429778e46159fd188df (diff)
downloadPaper-00b949f1bbbf444e2b5e7b8de7c9b14fbd2133c6.tar.gz
Paper-00b949f1bbbf444e2b5e7b8de7c9b14fbd2133c6.zip
Remove Moonrise utils to MCUtils, remove duplicated/unused utils
Diffstat (limited to 'patches/server/0430-Fix-client-lag-on-advancement-loading.patch')
-rw-r--r--patches/server/0430-Fix-client-lag-on-advancement-loading.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/patches/server/0430-Fix-client-lag-on-advancement-loading.patch b/patches/server/0430-Fix-client-lag-on-advancement-loading.patch
new file mode 100644
index 0000000000..ded2b5101b
--- /dev/null
+++ b/patches/server/0430-Fix-client-lag-on-advancement-loading.patch
@@ -0,0 +1,35 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jason Penilla <[email protected]>
+Date: Sat, 31 Oct 2020 11:49:01 -0700
+Subject: [PATCH] Fix client lag on advancement loading
+
+When new advancements are added via the UnsafeValues#loadAdvancement
+API, it triggers a full datapack reload when this is not necessary. The
+advancement is already loaded directly into the advancement registry,
+and the point of saving the advancement to the Bukkit datapack seems to
+be for persistence. By removing the call to reload datapacks when an
+advancement is loaded, the client no longer completely freezes up when
+adding a new advancement.
+To ensure the client still receives the updated advancement data, we
+manually reload the advancement data for all players, which
+normally takes place as a part of the datapack reloading.
+
+diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+index 94ec28a4f9d12873dff6700a12fb66e29820d3d9..7427a81a779b82f96d34a3de228c9d59ee77fea7 100644
+--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
++++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+@@ -333,7 +333,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
+ Bukkit.getLogger().log(Level.SEVERE, "Error saving advancement " + key, ex);
+ }
+
+- MinecraftServer.getServer().getPlayerList().reloadResources();
++ // Paper start - Fix client lag on advancement loading
++ //MinecraftServer.getServer().getPlayerList().reload();
++ MinecraftServer.getServer().getPlayerList().getPlayers().forEach(player -> {
++ player.getAdvancements().reload(MinecraftServer.getServer().getAdvancements());
++ player.getAdvancements().flushDirty(player);
++ });
++ // Paper end - Fix client lag on advancement loading
+
+ return bukkit;
+ }