13
0
geforkt von Mirrors/Paper

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.
Dieser Commit ist enthalten in:
Jason Penilla 2020-10-31 11:49:01 -07:00
Ursprung c8ba4fb789
Commit 9ac98063a0

Datei anzeigen

@ -318,7 +318,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;
}