Fix scores for 1.12
This commit is contained in:
parent
4c7ba6a9ad
commit
6c2cd6ac7a
@ -188,7 +188,12 @@ public class ReflectionManager {
|
|||||||
boardField.setAccessible(true);
|
boardField.setAccessible(true);
|
||||||
scoreboardCrtieriaHealth = getNmsField("IScoreboardCriteria", "HEALTH").get(null);
|
scoreboardCrtieriaHealth = getNmsField("IScoreboardCriteria", "HEALTH").get(null);
|
||||||
setScore = getNmsMethod("ScoreboardScore", "setScore", int.class);
|
setScore = getNmsMethod("ScoreboardScore", "setScore", int.class);
|
||||||
|
|
||||||
|
if (!NmsVersion.v1_13.isSupported()) {
|
||||||
|
getObjectives = getNmsMethod("Scoreboard", "getScoreboardScores", getNmsClass("IScoreboardCriteria"), String.class, ArrayList.class);
|
||||||
|
} else {
|
||||||
getObjectives = getNmsMethod("Scoreboard", "getObjectivesForCriteria", getNmsClass("IScoreboardCriteria"), String.class, Consumer.class);
|
getObjectives = getNmsMethod("Scoreboard", "getObjectivesForCriteria", getNmsClass("IScoreboardCriteria"), String.class, Consumer.class);
|
||||||
|
}
|
||||||
|
|
||||||
Method method = getNmsMethod("SoundCategory", "a");
|
Method method = getNmsMethod("SoundCategory", "a");
|
||||||
|
|
||||||
@ -1932,6 +1937,16 @@ public class ReflectionManager {
|
|||||||
try {
|
try {
|
||||||
Object board = boardField.get(scoreboard);
|
Object board = boardField.get(scoreboard);
|
||||||
|
|
||||||
|
if (!NmsVersion.v1_13.isSupported()) {
|
||||||
|
Collection scores = (Collection) getObjectives.invoke(board, criteria, name, new ArrayList<>());
|
||||||
|
|
||||||
|
for (Object obj : scores) {
|
||||||
|
setScore.invoke(obj, score);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Consumer con = o -> {
|
Consumer con = o -> {
|
||||||
try {
|
try {
|
||||||
setScore.invoke(o, score);
|
setScore.invoke(o, score);
|
||||||
|
Loading…
Reference in New Issue
Block a user