diff --git a/paper-server/patches/sources/net/minecraft/server/PlayerAdvancements.java.patch b/paper-server/patches/sources/net/minecraft/server/PlayerAdvancements.java.patch index bed58c139a..f503804d79 100644 --- a/paper-server/patches/sources/net/minecraft/server/PlayerAdvancements.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/PlayerAdvancements.java.patch @@ -1,6 +1,14 @@ --- a/net/minecraft/server/PlayerAdvancements.java +++ b/net/minecraft/server/PlayerAdvancements.java -@@ -196,6 +196,7 @@ +@@ -162,6 +162,7 @@ + } + + public void save() { ++ if (org.spigotmc.SpigotConfig.disableAdvancementSaving) return; // Spigot + JsonElement jsonelement = (JsonElement) this.codec.encodeStart(JsonOps.INSTANCE, this.asData()).getOrThrow(); + + try { +@@ -196,6 +197,7 @@ AdvancementHolder advancementholder = loader.get(minecraftkey); if (advancementholder == null) { @@ -8,7 +16,7 @@ PlayerAdvancements.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", minecraftkey, this.playerSavePath); } else { this.startProgress(advancementholder, advancementprogress); -@@ -227,6 +228,7 @@ +@@ -227,6 +229,7 @@ this.progressChanged.add(advancement); flag = true; if (!flag1 && advancementprogress.isDone()) { diff --git a/paper-server/patches/sources/net/minecraft/server/ServerAdvancementManager.java.patch b/paper-server/patches/sources/net/minecraft/server/ServerAdvancementManager.java.patch index 39dbd8090c..e7c82bd845 100644 --- a/paper-server/patches/sources/net/minecraft/server/ServerAdvancementManager.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/ServerAdvancementManager.java.patch @@ -16,7 +16,15 @@ private AdvancementTree tree = new AdvancementTree(); private final HolderLookup.Provider registries; -@@ -40,7 +44,7 @@ +@@ -37,10 +41,15 @@ + Builder builder = ImmutableMap.builder(); + + prepared.forEach((minecraftkey, advancement) -> { ++ // Spigot start ++ if (org.spigotmc.SpigotConfig.disabledAdvancements != null && (org.spigotmc.SpigotConfig.disabledAdvancements.contains("*") || org.spigotmc.SpigotConfig.disabledAdvancements.contains(minecraftkey.toString()) || org.spigotmc.SpigotConfig.disabledAdvancements.contains(minecraftkey.getNamespace()))) { ++ return; ++ } ++ // Spigot end this.validate(minecraftkey, advancement); builder.put(minecraftkey, new AdvancementHolder(minecraftkey, advancement)); }); diff --git a/paper-server/src/main/java/org/spigotmc/SpigotConfig.java b/paper-server/src/main/java/org/spigotmc/SpigotConfig.java index 711a319d22..ba5b472bdf 100644 --- a/paper-server/src/main/java/org/spigotmc/SpigotConfig.java +++ b/paper-server/src/main/java/org/spigotmc/SpigotConfig.java @@ -382,4 +382,11 @@ public class SpigotConfig Bukkit.getLogger().info( "Debug logging is disabled" ); } } + + public static boolean disableAdvancementSaving; + public static List disabledAdvancements; + private static void disabledAdvancements() { + SpigotConfig.disableAdvancementSaving = SpigotConfig.getBoolean("advancements.disable-saving", false); + SpigotConfig.disabledAdvancements = SpigotConfig.getList("advancements.disabled", Arrays.asList(new String[]{"minecraft:story/disabled"})); + } }