From 6f5a3c352f9cc6298e279da22b29f5cdc5f7017d Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 15 Mar 2022 13:23:37 +0100 Subject: [PATCH] Fix emblem not being the highest --- src/de/steamwar/bungeecore/sql/UserElo.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/sql/UserElo.java b/src/de/steamwar/bungeecore/sql/UserElo.java index 657661a..42632c8 100644 --- a/src/de/steamwar/bungeecore/sql/UserElo.java +++ b/src/de/steamwar/bungeecore/sql/UserElo.java @@ -107,6 +107,8 @@ public class UserElo { return emblemCache.get(user.getId()); } + int maxEmblemProgression = 0; + int maxEloOfGameMode = 0; int maxEloOfPlayer = 0; ArenaMode arenaMode = null; for (ArenaMode mode : ArenaMode.getAllModes()) { @@ -114,9 +116,15 @@ public class UserElo { if (UserElo.getFightsOfSeason(user.getId(), mode.getSchemType()) < 10) continue; Optional currentElo = UserElo.getElo(user.getId(), mode.getSchemType()); - if (currentElo.isPresent() && currentElo.get() > maxEloOfPlayer) { - maxEloOfPlayer = currentElo.get(); - arenaMode = mode; + if (currentElo.isPresent()) { + int currentMaxEloOfGameMode = UserElo.getMaxElo(mode.getSchemType()); + int progression = getProgression(currentElo.get(), currentMaxEloOfGameMode); + if (progression > maxEmblemProgression) { + maxEmblemProgression = progression; + maxEloOfGameMode = currentMaxEloOfGameMode; + maxEloOfPlayer = currentElo.get(); + arenaMode = mode; + } } } @@ -124,7 +132,6 @@ public class UserElo { emblemCache.put(user.getId(), ""); return ""; } - int maxEloOfGameMode = UserElo.getMaxElo(arenaMode.getSchemType()); String emblem = getEmblem(maxEloOfPlayer, maxEloOfGameMode); emblemCache.put(user.getId(), emblem); return emblem;