Fix 1.12 again
This commit is contained in:
parent
6922bcd9e8
commit
44f90e51ee
@ -107,6 +107,7 @@ public class ReflectionManager {
|
|||||||
private static Field boardField;
|
private static Field boardField;
|
||||||
public static Object scoreboardCrtieriaHealth;
|
public static Object scoreboardCrtieriaHealth;
|
||||||
private static Method getObjectives;
|
private static Method getObjectives;
|
||||||
|
private static Method getPlayerScoreObjective;
|
||||||
private static Method setScore;
|
private static Method setScore;
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
@ -189,7 +190,8 @@ public class ReflectionManager {
|
|||||||
setScore = getNmsMethod("ScoreboardScore", "setScore", int.class);
|
setScore = getNmsMethod("ScoreboardScore", "setScore", int.class);
|
||||||
|
|
||||||
if (!NmsVersion.v1_13.isSupported()) {
|
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 {
|
} else {
|
||||||
getObjectives = getNmsMethod("Scoreboard", "getObjectivesForCriteria", getNmsClass("IScoreboardCriteria"), String.class, Consumer.class);
|
getObjectives = getNmsMethod("Scoreboard", "getObjectivesForCriteria", getNmsClass("IScoreboardCriteria"), String.class, Consumer.class);
|
||||||
}
|
}
|
||||||
@ -1937,9 +1939,9 @@ public class ReflectionManager {
|
|||||||
Object board = boardField.get(scoreboard);
|
Object board = boardField.get(scoreboard);
|
||||||
|
|
||||||
if (!NmsVersion.v1_13.isSupported()) {
|
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);
|
setScore.invoke(obj, score);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user