aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0520-Fix-client-lag-on-advancement-loading.patch
diff options
context:
space:
mode:
authorNassim Jahnke <[email protected]>2021-11-24 17:39:04 +0100
committerMiniDigger | Martin <[email protected]>2021-11-30 19:26:33 +0100
commit26dcf812a4cb38096c4c08a711a452d8c377395c (patch)
tree314b7dbba5a81779d6cc4a9c28536f977ed4b82d /patches/server/0520-Fix-client-lag-on-advancement-loading.patch
parent97a4a707665251ee55f5f7ed609f8d3779c6ded9 (diff)
downloadPaper-26dcf812a4cb38096c4c08a711a452d8c377395c.tar.gz
Paper-26dcf812a4cb38096c4c08a711a452d8c377395c.zip
More more more more more more more more more more more more more more more work
Diffstat (limited to 'patches/server/0520-Fix-client-lag-on-advancement-loading.patch')
-rw-r--r--patches/server/0520-Fix-client-lag-on-advancement-loading.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/patches/server/0520-Fix-client-lag-on-advancement-loading.patch b/patches/server/0520-Fix-client-lag-on-advancement-loading.patch
new file mode 100644
index 0000000000..5d872f5877
--- /dev/null
+++ b/patches/server/0520-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 5d5720b2a6cbf9d73b6c7413e4ddc5cc114b9448..ea45befec7e03f48da00f8a77dcae6561745a01e 100644
+--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
++++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+@@ -306,7 +306,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
+ Bukkit.getLogger().log(Level.SEVERE, "Error saving advancement " + key, ex);
+ }
+
+- MinecraftServer.getServer().getPlayerList().reloadResources();
++ // Paper start
++ //MinecraftServer.getServer().getPlayerList().reload();
++ MinecraftServer.getServer().getPlayerList().getPlayers().forEach(player -> {
++ player.getAdvancements().reload(MinecraftServer.getServer().getAdvancements());
++ player.getAdvancements().flushDirty(player);
++ });
++ // Paper end
+
+ return bukkit;
+ }