From 072b59060c486df5c44862b2663495ab4528226c Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Tue, 7 May 2024 17:07:13 +0200 Subject: [PATCH] Don't write null criteria for unknown advancements --- .../provider/BukkitAdvancementCriteriaProvider.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bukkit/src/main/java/com/viaversion/viabackwards/provider/BukkitAdvancementCriteriaProvider.java b/bukkit/src/main/java/com/viaversion/viabackwards/provider/BukkitAdvancementCriteriaProvider.java index 8e886666..7f5d0162 100644 --- a/bukkit/src/main/java/com/viaversion/viabackwards/provider/BukkitAdvancementCriteriaProvider.java +++ b/bukkit/src/main/java/com/viaversion/viabackwards/provider/BukkitAdvancementCriteriaProvider.java @@ -24,12 +24,11 @@ import org.bukkit.advancement.Advancement; public final class BukkitAdvancementCriteriaProvider extends AdvancementCriteriaProvider { + private static final String[] EMPTY_CRITERIA = new String[0]; + @Override public String[] getCriteria(final String key) { final Advancement advancement = Bukkit.getAdvancement(NamespacedKey.fromString(key)); - if (advancement == null) { - return null; - } - return advancement.getCriteria().toArray(new String[0]); + return advancement == null ? EMPTY_CRITERIA : advancement.getCriteria().toArray(EMPTY_CRITERIA); } }