summaryrefslogtreecommitdiffhomepage
path: root/patches/server/0853-Fix-custom-statistic-criteria-creation.patch
blob: a3e8b66e3a4764d1613becea7c1295f2da5a8ab4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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 39066b1d8df7f784e4c90b5fd47505ef65db307c..2d5cb690c332732d1d2a9e78918cd5e8595b37e9 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -593,6 +593,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) {