mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-17 18:47:40 +01:00
Configurable Advancement Disabling
Allow disabling any (or all) inbuilt advancements with a configuration option. By: md_5 <git@md-5.net>
This commit is contained in:
parent
93fea68749
commit
d16d3c3548
3 changed files with 26 additions and 3 deletions
paper-server
patches/sources/net/minecraft/server
src/main/java/org/spigotmc
|
@ -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()) {
|
||||
|
|
|
@ -16,7 +16,15 @@
|
|||
private AdvancementTree tree = new AdvancementTree();
|
||||
private final HolderLookup.Provider registries;
|
||||
|
||||
@@ -40,7 +44,7 @@
|
||||
@@ -37,10 +41,15 @@
|
||||
Builder<ResourceLocation, AdvancementHolder> 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));
|
||||
});
|
||||
|
|
|
@ -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() {
|
||||
SpigotConfig.disableAdvancementSaving = SpigotConfig.getBoolean("advancements.disable-saving", false);
|
||||
SpigotConfig.disabledAdvancements = SpigotConfig.getList("advancements.disabled", Arrays.asList(new String[]{"minecraft:story/disabled"}));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue