Archiviert
1
0

Update some stuff

Dieser Commit ist enthalten in:
yoyosource 2022-03-11 13:23:50 +01:00
Ursprung 4e5bd18ef9
Commit 68ba6a26f7
3 geänderte Dateien mit 8 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -31,6 +31,8 @@ import net.md_5.bungee.api.config.ServerInfo;
import java.util.List; import java.util.List;
import static de.steamwar.bungeecore.sql.UserElo.ELO_DEFAULT;
public class FightEndsHandler implements SpigotHandler { public class FightEndsHandler implements SpigotHandler {
private int K = 20; private int K = 20;
@ -83,7 +85,7 @@ public class FightEndsHandler implements SpigotHandler {
private void calculateEloOfTeam(List<Integer> team, String gameMode, double factor) { private void calculateEloOfTeam(List<Integer> team, String gameMode, double factor) {
for (int player : team) { for (int player : team) {
int playerElo = UserElo.getElo(player, gameMode).orElse(1000); int playerElo = UserElo.getElo(player, gameMode).orElse(ELO_DEFAULT);
UserElo.setElo(player, gameMode, (int) Math.round(playerElo + K * factor)); UserElo.setElo(player, gameMode, (int) Math.round(playerElo + K * factor));
} }
} }

Datei anzeigen

@ -19,6 +19,8 @@
package de.steamwar.bungeecore.sql; package de.steamwar.bungeecore.sql;
import static de.steamwar.bungeecore.sql.UserElo.ELO_DEFAULT;
public class SchemElo { public class SchemElo {
private SchemElo() {} private SchemElo() {}
@ -33,7 +35,7 @@ public class SchemElo {
return elo.select(rs -> { return elo.select(rs -> {
if (rs.next()) if (rs.next())
return rs.getInt("Elo"); return rs.getInt("Elo");
return 1000; return ELO_DEFAULT;
}, schemID, season); }, schemID, season);
} }

Datei anzeigen

@ -31,6 +31,8 @@ public class UserElo {
private UserElo() { private UserElo() {
} }
public static final int ELO_DEFAULT = 1000;
private static final Map<Key, Optional<Integer>> userEloCache = new HashMap<>(); private static final Map<Key, Optional<Integer>> userEloCache = new HashMap<>();
private static final Map<String, Integer> maxEloCache = new HashMap<>(); private static final Map<String, Integer> maxEloCache = new HashMap<>();
private static final Map<Integer, String> emblemCache = new HashMap<>(); private static final Map<Integer, String> emblemCache = new HashMap<>();