diff --git a/src/de/steamwar/bungeecore/comms/handlers/FightEndsHandler.java b/src/de/steamwar/bungeecore/comms/handlers/FightEndsHandler.java index 86d45fe..d54d239 100644 --- a/src/de/steamwar/bungeecore/comms/handlers/FightEndsHandler.java +++ b/src/de/steamwar/bungeecore/comms/handlers/FightEndsHandler.java @@ -31,6 +31,8 @@ import net.md_5.bungee.api.config.ServerInfo; import java.util.List; +import static de.steamwar.bungeecore.sql.UserElo.ELO_DEFAULT; + public class FightEndsHandler implements SpigotHandler { private int K = 20; @@ -83,7 +85,7 @@ public class FightEndsHandler implements SpigotHandler { private void calculateEloOfTeam(List team, String gameMode, double factor) { 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)); } } diff --git a/src/de/steamwar/bungeecore/sql/SchemElo.java b/src/de/steamwar/bungeecore/sql/SchemElo.java index 5fa8d89..378d2db 100644 --- a/src/de/steamwar/bungeecore/sql/SchemElo.java +++ b/src/de/steamwar/bungeecore/sql/SchemElo.java @@ -19,6 +19,8 @@ package de.steamwar.bungeecore.sql; +import static de.steamwar.bungeecore.sql.UserElo.ELO_DEFAULT; + public class SchemElo { private SchemElo() {} @@ -33,7 +35,7 @@ public class SchemElo { return elo.select(rs -> { if (rs.next()) return rs.getInt("Elo"); - return 1000; + return ELO_DEFAULT; }, schemID, season); } diff --git a/src/de/steamwar/bungeecore/sql/UserElo.java b/src/de/steamwar/bungeecore/sql/UserElo.java index ddeae96..8593cae 100644 --- a/src/de/steamwar/bungeecore/sql/UserElo.java +++ b/src/de/steamwar/bungeecore/sql/UserElo.java @@ -31,6 +31,8 @@ public class UserElo { private UserElo() { } + public static final int ELO_DEFAULT = 1000; + private static final Map> userEloCache = new HashMap<>(); private static final Map maxEloCache = new HashMap<>(); private static final Map emblemCache = new HashMap<>();