From 0d888dff1c93374dfeab24610e310bd930e5a44f Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 15 Mar 2022 10:35:11 +0100 Subject: [PATCH] Update RankCommand --- src/de/steamwar/bungeecore/commands/RankCommand.java | 2 +- src/de/steamwar/bungeecore/sql/UserElo.java | 9 +++++++-- src/de/steamwar/messages/BungeeCore.properties | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/RankCommand.java b/src/de/steamwar/bungeecore/commands/RankCommand.java index 8bb0b71..f76932e 100644 --- a/src/de/steamwar/bungeecore/commands/RankCommand.java +++ b/src/de/steamwar/bungeecore/commands/RankCommand.java @@ -64,7 +64,7 @@ public class RankCommand extends BasicCommand { } else { Message.send("RANK_UNPLACED", player); } - Message.send("RANK_EMBLEM", player, UserElo.getEmblemProgression(mode.getChatName(), user.getId())); + Message.send("RANK_EMBLEM", player, UserElo.getEmblemProgression(player, mode.getChatName(), user.getId())); } } } diff --git a/src/de/steamwar/bungeecore/sql/UserElo.java b/src/de/steamwar/bungeecore/sql/UserElo.java index cc418a0..db30f5c 100644 --- a/src/de/steamwar/bungeecore/sql/UserElo.java +++ b/src/de/steamwar/bungeecore/sql/UserElo.java @@ -20,6 +20,8 @@ package de.steamwar.bungeecore.sql; import de.steamwar.bungeecore.ArenaMode; +import de.steamwar.bungeecore.Message; +import net.md_5.bungee.api.connection.ProxiedPlayer; import java.util.HashMap; import java.util.Map; @@ -138,8 +140,11 @@ public class UserElo { return "§7✧ "; } - public static String getEmblemProgression(String gameMode, int userId) { - if (UserElo.getFightsOfSeason(userId, gameMode) < 10) return "§8✧ ✦ ✶ ✷ ✸ ✹ ❂"; + public static String getEmblemProgression(ProxiedPlayer player, String gameMode, int userId) { + int fightsOfSeason = getFightsOfSeason(userId, gameMode); + if (fightsOfSeason < 10) { + return Message.parse("RANK_NEEDED_FIGHTS_LEFT", player, "§8✧ ✦ ✶ ✷ ✸ ✹ ❂", 11 - fightsOfSeason); + } Optional currentElo = UserElo.getElo(userId, gameMode); if (!currentElo.isPresent()) return "§8✧ ✦ ✶ ✷ ✸ ✹ ❂"; int maxEloOfGameMode = UserElo.getMaxElo(gameMode); diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index acd2fbc..4133ce9 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -569,3 +569,4 @@ RANK_HEADER=§7§lModus {0} RANK_UNPLACED=§eunplatziert RANK_PLACED=§e{0}§8. §7mit §e{1} §7Elo§8. RANK_EMBLEM=§eEmblem§8: {0} +RANK_NEEDED_FIGHTS_LEFT={0} §8(§7noch §e{1}§7 Fights nötig§8)