From 44f90e51ee40b27caa6f944356e2fdd9fad69fb0 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Wed, 3 Feb 2021 23:06:32 +1300 Subject: [PATCH] Fix 1.12 again --- .../disguise/utilities/reflection/ReflectionManager.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java b/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java index 9f617bbd..cab135da 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java @@ -107,6 +107,7 @@ public class ReflectionManager { private static Field boardField; public static Object scoreboardCrtieriaHealth; private static Method getObjectives; + private static Method getPlayerScoreObjective; private static Method setScore; public static void init() { @@ -189,7 +190,8 @@ public class ReflectionManager { setScore = getNmsMethod("ScoreboardScore", "setScore", int.class); if (!NmsVersion.v1_13.isSupported()) { - getObjectives = getNmsMethod("Scoreboard", "getScoreboardScores", getNmsClass("IScoreboardCriteria"), String.class, ArrayList.class); + getObjectives = getNmsMethod("Scoreboard", "getObjectivesForCriteria", getNmsClass("IScoreboardCriteria")); + getPlayerScoreObjective = getNmsMethod("Scoreboard", "getObjectivesForCriteria", String.class, getNmsClass("IScoreboardCriteria")); } else { getObjectives = getNmsMethod("Scoreboard", "getObjectivesForCriteria", getNmsClass("IScoreboardCriteria"), String.class, Consumer.class); } @@ -1937,9 +1939,9 @@ public class ReflectionManager { Object board = boardField.get(scoreboard); if (!NmsVersion.v1_13.isSupported()) { - Collection scores = (Collection) getObjectives.invoke(board, criteria, name, new ArrayList<>()); + Collection scores = (Collection) getObjectives.invoke(board, criteria); - for (Object obj : scores) { + for (Object obj : (Collection) getPlayerScoreObjective.invoke(board, name, criteria)) { setScore.invoke(obj, score); }