Hotfix ArenaMode with RankCommand

This commit is contained in:
2024-08-06 15:39:59 +02:00
parent a53fd19887
commit 7516cf5854
4 changed files with 14 additions and 9 deletions
@@ -664,10 +664,9 @@ ARENA_NOT_FOUND=§cThe specified arena could not be found
#Rank
RANK_PLAYER_NOT_FOUND=§cPlayer not found
RANK_PLAYER_FOUND=§eRank §7of §e{0}
RANK_HEADER=§e{0} {1}
RANK_HEADER={0} §e{1} {2}
RANK_UNPLACED=§7unranked
RANK_PLACED=§e{0}§8. §7with §e{1} §7Elo§8.
RANK_EMBLEM=§7Emblem§8: {0}
#Fabric Mod Sender
MODIFICATION_BAN_MESSAGE=You tried to bypass / modify the FabricModSender!
@@ -639,7 +639,7 @@ ARENA_NOT_FOUND=§cDie angegebene Arena konnte nicht gefunden werden
#Rank
RANK_PLAYER_NOT_FOUND=§cSpieler nicht gefunden
RANK_PLAYER_FOUND=§eRang §7von §e{0}
RANK_HEADER=§e{0} {1}
RANK_HEADER={0} §e{1} {2}
RANK_UNPLACED=§7unplatziert
RANK_PLACED=§e{0}§8. §7mit §e{1} §7Elo§8.
RANK_EMBLEM=§7Emblem§8: {0}
@@ -118,4 +118,11 @@ public class ArenaMode extends GameModeConfig {
return getServer().getChatNames().isEmpty();
}
public String getSchemTypeOrInternalName() {
Schematic schematic = getSchematic();
if (schematic == null) {
return internalName;
}
return schematic.getType();
}
}
@@ -19,12 +19,12 @@
package de.steamwar.velocitycore.commands;
import de.steamwar.velocitycore.ArenaMode;
import de.steamwar.messages.Message;
import de.steamwar.command.SWCommand;
import de.steamwar.messages.Chatter;
import de.steamwar.messages.Message;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserElo;
import de.steamwar.velocitycore.ArenaMode;
import java.util.Optional;
@@ -48,17 +48,16 @@ public class RankCommand extends SWCommand {
if (!mode.isRanked())
continue;
Optional<Integer> elo = UserElo.getElo(user.getId(), mode.getSchemType());
Optional<Integer> elo = UserElo.getElo(user.getId(), mode.getSchemTypeOrInternalName());
Message eloMsg;
if (elo.isPresent()) {
int placement = UserElo.getPlacement(elo.get(), mode.getSchemType());
int placement = UserElo.getPlacement(elo.get(), mode.getSchemTypeOrInternalName());
eloMsg = new Message("RANK_PLACED", placement, elo.get());
} else {
eloMsg = new Message("RANK_UNPLACED");
}
sender.prefixless("RANK_HEADER", mode.getChatName(), eloMsg);
sender.prefixless("RANK_EMBLEM", UserElo.getEmblemProgression(mode.getChatName(), user.getId()));
sender.prefixless("RANK_HEADER", UserElo.getEmblemProgression(mode.getChatName(), user.getId()), mode.getChatName(), eloMsg);
}
}
}