0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/spigot.git synced 2024-11-21 22:06:13 +00:00
spigot/CraftBukkit-Patches/0069-Configurable-Advancement-Disabling.patch
2024-10-23 02:15:00 +11:00

55 lines
2.7 KiB
Diff

From 45908f95fbaed65367cb8df7b9467daa1924b37e Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Fri, 9 Jun 2017 16:29:31 +1000
Subject: [PATCH] Configurable Advancement Disabling
Allow disabling any (or all) inbuilt advancements with a configuration option.
diff --git a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java
index 51eea97956..d2d8018b3e 100644
--- a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java
+++ b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java
@@ -162,6 +162,7 @@ public class AdvancementDataPlayer {
}
public void save() {
+ if (org.spigotmc.SpigotConfig.disableAdvancementSaving) return; // Spigot
JsonElement jsonelement = (JsonElement) this.codec.encodeStart(JsonOps.INSTANCE, this.asData()).getOrThrow();
try {
diff --git a/src/main/java/net/minecraft/server/AdvancementDataWorld.java b/src/main/java/net/minecraft/server/AdvancementDataWorld.java
index b3d6afa89b..5a07a19592 100644
--- a/src/main/java/net/minecraft/server/AdvancementDataWorld.java
+++ b/src/main/java/net/minecraft/server/AdvancementDataWorld.java
@@ -41,6 +41,11 @@ public class AdvancementDataWorld extends ResourceDataJson<Advancement> {
Builder<MinecraftKey, AdvancementHolder> builder = ImmutableMap.builder();
map.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/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 11a716f919..c17d581422 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/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<String> disabledAdvancements;
+ private static void disabledAdvancements() {
+ disableAdvancementSaving = getBoolean("advancements.disable-saving", false);
+ disabledAdvancements = getList("advancements.disabled", Arrays.asList(new String[]{"minecraft:story/disabled"}));
+ }
}
--
2.47.0