Archiviert
1
0

Merge pull request 'Update RankCommand' (#311) from Ranked into master

Reviewed-on: SteamWar/BungeeCore#311
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Lixfel 2022-03-15 15:14:11 +01:00
Commit d32488a4b7
3 geänderte Dateien mit 20 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -41,6 +41,15 @@ public class RankCommand extends BasicCommand {
ProxiedPlayer player = (ProxiedPlayer) sender; ProxiedPlayer player = (ProxiedPlayer) sender;
SteamwarUser user = SteamwarUser.get(player.getUniqueId()); SteamwarUser user = SteamwarUser.get(player.getUniqueId());
if (args.length > 0) {
SteamwarUser nUser = SteamwarUser.get(args[0]);
if (nUser == null) {
Message.send("RANK_PLAYER_NOT_FOUND", player);
return;
}
Message.send("RANK_PLAYER_FOUND", player, nUser.getUserName());
user = nUser;
}
for(ArenaMode mode : ArenaMode.getAllModes()) { for(ArenaMode mode : ArenaMode.getAllModes()) {
if (!mode.isRanked()) if (!mode.isRanked())
continue; continue;
@ -55,7 +64,7 @@ public class RankCommand extends BasicCommand {
} else { } else {
Message.send("RANK_UNPLACED", player); 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()));
} }
} }
} }

Datei anzeigen

@ -20,6 +20,8 @@
package de.steamwar.bungeecore.sql; package de.steamwar.bungeecore.sql;
import de.steamwar.bungeecore.ArenaMode; 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.HashMap;
import java.util.Map; import java.util.Map;
@ -145,8 +147,11 @@ public class UserElo {
return "§7✧ "; return "§7✧ ";
} }
public static String getEmblemProgression(String gameMode, int userId) { public static String getEmblemProgression(ProxiedPlayer player, String gameMode, int userId) {
if (UserElo.getFightsOfSeason(userId, gameMode) < 10) return "§8✧ ✦ ✶ ✷ ✸ ✹ ❂"; int fightsOfSeason = getFightsOfSeason(userId, gameMode);
if (fightsOfSeason < 10) {
return Message.parse("RANK_NEEDED_FIGHTS_LEFT", player, "§8✧ ✦ ✶ ✷ ✸ ✹ ❂", 10 - fightsOfSeason);
}
Optional<Integer> currentElo = UserElo.getElo(userId, gameMode); Optional<Integer> currentElo = UserElo.getElo(userId, gameMode);
if (!currentElo.isPresent()) return "§8✧ ✦ ✶ ✷ ✸ ✹ ❂"; if (!currentElo.isPresent()) return "§8✧ ✦ ✶ ✷ ✸ ✹ ❂";
int maxEloOfGameMode = UserElo.getMaxElo(gameMode); int maxEloOfGameMode = UserElo.getMaxElo(gameMode);

Datei anzeigen

@ -563,7 +563,10 @@ HOURS_PLAYED=§7Deine Spielzeit beträgt§8: §e{0}h
ARENA_NOT_FOUND=§cDie angegebene Arena konnte nicht gefunden werden ARENA_NOT_FOUND=§cDie angegebene Arena konnte nicht gefunden werden
#Rank #Rank
RANK_PLAYER_NOT_FOUND=§cSpieler nicht gefunden
RANK_PLAYER_FOUND=§eRang §7von §e{0}
RANK_HEADER=§7§lModus {0} RANK_HEADER=§7§lModus {0}
RANK_UNPLACED=§eunplatziert RANK_UNPLACED=§eunplatziert
RANK_PLACED=§e{0}§8. §7mit §e{1} §7Elo§8. RANK_PLACED=§e{0}§8. §7mit §e{1} §7Elo§8.
RANK_EMBLEM=§eEmblem§8: {0} RANK_EMBLEM=§eEmblem§8: {0}
RANK_NEEDED_FIGHTS_LEFT={0} §8(§7noch §e{1}§7 Kämpfe nötig§8)