Archiviert
1
0
Dieser Commit ist enthalten in:
yoyosource 2022-03-14 20:05:16 +01:00
Ursprung af978cab2b
Commit 92c0e58590

Datei anzeigen

@ -24,7 +24,6 @@ import de.steamwar.bungeecore.ArenaMode;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicBoolean;
public class UserElo {
private UserElo() {
@ -79,18 +78,14 @@ public class UserElo {
public static void setElo(int userId, String gameMode, int elo) {
emblemCache.remove(userId);
Optional<Integer> previousElo = gameModeUserEloCache.computeIfAbsent(gameMode, gm -> new HashMap<>()).put(userId, Optional.of(elo));
AtomicBoolean invalidate = new AtomicBoolean(false);
maxEloCache.compute(gameMode, (gm, max) -> {
int newElo = maxEloCache.compute(gameMode, (gm, max) -> {
if (max == null || max < elo) {
emblemCache.clear();
return elo;
}
if (previousElo != null && previousElo.isPresent() && previousElo.get() == (int) max) {
invalidate.set(true);
}
return max;
});
if (invalidate.get()) {
if (previousElo != null && previousElo.isPresent() && previousElo.get() == newElo) {
maxEloCache.remove(gameMode);
emblemCache.clear();
}