2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
21 # Latest version
]
# and run on both Linux and Windows
os: [ubuntu-20.04]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: checkout repository
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ org.gradle.jvmargs=-Xmx1G
fabric_version=0.119.1+1.21.5

# Mod Properties
mod_version = 2.6.2+1.21.5
mod_version = 2.6.3+1.21.5
maven_group = eu.pb4
archives_base_name = placeholder-api
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Collection;
import java.util.Date;
import java.util.Objects;
import java.util.*;
import java.util.concurrent.TimeUnit;

public class ServerPlaceholders {
Expand Down Expand Up @@ -185,8 +183,10 @@ public static void register() {
}
try {
int position = Integer.parseInt(args[1]);
Collection<ScoreboardEntry> scoreboardEntries = scoreboard.getScoreboardEntries(scoreboardObjective);
ScoreboardEntry scoreboardEntry = scoreboardEntries.toArray(ScoreboardEntry[]::new)[scoreboardEntries.size() - position];
List<ScoreboardEntry> scoreboardEntries = new ArrayList<>(scoreboard.getScoreboardEntries(scoreboardObjective));
scoreboardEntries.sort(Comparator.comparingInt(ScoreboardEntry::value).reversed());

ScoreboardEntry scoreboardEntry = scoreboardEntries.get(position - 1);
return PlaceholderResult.value(scoreboardEntry.name());
} catch (Exception e) {
/* Into the void you go! */
Expand All @@ -205,8 +205,10 @@ public static void register() {
}
try {
int position = Integer.parseInt(args[1]);
Collection<ScoreboardEntry> scoreboardEntries = scoreboard.getScoreboardEntries(scoreboardObjective);
ScoreboardEntry scoreboardEntry = scoreboardEntries.toArray(ScoreboardEntry[]::new)[scoreboardEntries.size() - position];
List<ScoreboardEntry> scoreboardEntries = new ArrayList<>(scoreboard.getScoreboardEntries(scoreboardObjective));
scoreboardEntries.sort(Comparator.comparingInt(ScoreboardEntry::value).reversed());

ScoreboardEntry scoreboardEntry = scoreboardEntries.get(position - 1);
return PlaceholderResult.value(String.valueOf(scoreboardEntry.value()));
} catch (Exception e) {
/* Into the void you go! */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public static void register() {
false,
(nodes, data, parser) -> {
if (!data.isEmpty()) {
return new ClickActionNode(nodes, ClickEvent.Action.RUN_COMMAND, parser.parseNode(data.get("value", 0)));
return new ClickActionNode(nodes, ClickEvent.Action.RUN_COMMAND, parser.parseNode(data.get("value", 0, "")));
}
return new ParentNode(nodes);
}
Expand Down Expand Up @@ -287,7 +287,7 @@ public static void register() {
false, (nodes, data, parser) -> {

if (!data.isEmpty()) {
return new ClickActionNode(nodes, ClickEvent.Action.OPEN_URL, parser.parseNode(data.get("value", 0)));
return new ClickActionNode(nodes, ClickEvent.Action.OPEN_URL, parser.parseNode(data.get("value", 0, "")));
}
return new ParentNode(nodes);
}
Expand Down