13
0

Fix Leaderboard loading
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2024-07-21 14:08:42 +02:00
Ursprung 89e8337320
Commit 950f7716b3

Datei anzeigen

@ -21,7 +21,7 @@ import java.util.Map;
public class Leaderboard implements Listener {
private static final Statement LEADERBOARD = new Statement("SELECT User, CAST(Value as integer) AS Time from UserConfig WHERE Config = ? ORDER BY CAST(Value as integer) LIMIT ?");
private static final Statement LEADERBOARD = new Statement("SELECT User, CAST(Value as integer) AS Time from UserConfig WHERE Config = ? ORDER BY CAST(Value as integer) ASC LIMIT ?");
private static final Statement PLAYER_TIME = new Statement("SELECT CAST(Value as integer) AS Time FROM UserConfig WHERE Config = ? AND User = ?");
private static final Statement PLAYER_PLACEMENT = new Statement("SELECT COUNT(*) AS Placement FROM UserConfig WHERE Config = ? AND CAST(Value as integer) < (SELECT CAST(Value as integer) AS Time FROM UserConfig WHERE Config = ? AND User = ?)");
@ -46,15 +46,14 @@ public class Leaderboard implements Listener {
List<LeaderboardEntry> leaderboard = getLeaderboard();
if (leaderboard.isEmpty()) return;
bestTime = leaderboard.get(0).time;
for (int i = 0; i <= best; i++) {
if (best - i >= leaderboard.size()) continue;
LeaderboardEntry entry = leaderboard.get(best - i);
RArmorStand entity = new RArmorStand(server, location.clone().add(0, i * 0.32, 0), RArmorStand.Size.MARKER);
for (int i = 0; i < leaderboard.size(); i++) {
LeaderboardEntry entry = leaderboard.get(i);
RArmorStand entity = new RArmorStand(server, location.clone().add(0, (leaderboard.size() - i - 1) * 0.32, 0), RArmorStand.Size.MARKER);
SteamwarUser user = SteamwarUser.get(entry.user);
String color = "§f";
if (i == best) {
if (i == 0) {
color = "§6§l";
} else if (i <= best - 1 && i > best- 3) {
} else if (i < 3) {
color = "§e";
}
entity.setDisplayName(calcName(user, color, i + 1, entry.time));