PaperMC/patches/server/0862-Fix-custom-statistic-criteria-creation.patch
2024-06-14 14:07:44 -07:00

25 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Noah van der Aa <ndvdaa@gmail.com>
Date: Sat, 12 Aug 2023 15:33:49 +0200
Subject: [PATCH] Fix custom statistic criteria creation
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 7272f154644366c3c467b265aadc59b879a7b7bd..a98fcfcf71b2a072d60120046d9aac9ad4546196 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -610,6 +610,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end - namespaced key biome methods
+ // Paper start - fix custom stats criteria creation
+ @Override
+ public String getStatisticCriteriaKey(org.bukkit.Statistic statistic) {
+ if (statistic.getType() != org.bukkit.Statistic.Type.UNTYPED) return "minecraft.custom:minecraft." + statistic.getKey().getKey();
+ return org.bukkit.craftbukkit.CraftStatistic.getNMSStatistic(statistic).getName();
+ }
+ // Paper end - fix custom stats criteria creation
+
@Override
public String get(Class<?> aClass, String s) {
if (aClass == Enchantment.class) {