13
0
geforkt von Mirrors/Paper

Configurable Advancement Disabling

Allow disabling any (or all) inbuilt advancements with a configuration option.

By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2017-06-09 16:29:31 +10:00
Ursprung 93fea68749
Commit d16d3c3548
3 geänderte Dateien mit 26 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -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()) {

Datei anzeigen

@ -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));
});

Datei anzeigen

@ -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"}));
}
}