Dieser Commit ist enthalten in:
Ursprung
4e5bd18ef9
Commit
68ba6a26f7
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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<>();
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren