From 3b2125b47d4159d1f7c95cae9697e15d441e81e9 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

---
 .../java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 088ff124ca..cd00165ebb 100644
--- a/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -608,6 +608,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
     public void setBiomeKey(org.bukkit.RegionAccessor accessor, int x, int y, int z, org.bukkit.NamespacedKey biomeKey) {
         accessor.setBiome(x, y, z, org.bukkit.Registry.BIOME.getOrThrow(biomeKey));
     }
+
+    @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
 
     /**