Archiviert
1
0

Add Only Active Punishments on Whois

Signed-off-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Chaoscaot 2021-12-30 19:55:06 +01:00
Ursprung edbeabcac9
Commit 862176b0f0
2 geänderte Dateien mit 28 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -68,10 +68,15 @@ public class WhoisCommand extends BasicCommand {
return; return;
} }
sendUserinfo(player, user); boolean all = false;
if(args.length > 1 && args[1].startsWith("-")) {
all = args[1].contains("a");
} }
private static void sendUserinfo(ProxiedPlayer player, SteamwarUser user) { sendUserinfo(player, user, all);
}
private static void sendUserinfo(ProxiedPlayer player, SteamwarUser user, boolean all) {
Message.send("WHOIS_USERNAME", player, user.getUserName()); Message.send("WHOIS_USERNAME", player, user.getUserName());
Message.send("WHOIS_UUID", player, Message.parse("WHOIS_UUID_HOVER", player), new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, user.getUuid().toString()), user.getUuid().toString()); Message.send("WHOIS_UUID", player, Message.parse("WHOIS_UUID_HOVER", player), new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, user.getUuid().toString()), user.getUuid().toString());
Message.send("WHOIS_ID", player, user.getId()); Message.send("WHOIS_ID", player, user.getId());
@ -89,13 +94,24 @@ public class WhoisCommand extends BasicCommand {
Message.send("WHOIS_TEAM", player, Message.parse("WHOIS_TEAM_HOVER", player, team.getTeamName()), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team info " + team.getTeamKuerzel()), team.getTeamColor(), team.getTeamKuerzel(), team.getTeamName()); Message.send("WHOIS_TEAM", player, Message.parse("WHOIS_TEAM_HOVER", player, team.getTeamName()), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team info " + team.getTeamKuerzel()), team.getTeamColor(), team.getTeamKuerzel(), team.getTeamName());
Message.send("WHOIS_PUNISHMENTS", player); Message.send("WHOIS_PUNISHMENTS", player);
if(all) {
List<Punishment> punishmentList = Punishment.getAllPunishmentsOfPlayer(user.getId()); List<Punishment> punishmentList = Punishment.getAllPunishmentsOfPlayer(user.getId());
if(punishmentList.isEmpty()) { if(punishmentList.isEmpty()) {
Message.send("WHOIS_NO_PUNISHMENT", player); Message.send("WHOIS_NO_ALL_PUNISHMENT", player);
return; return;
} }
for (Punishment punishment : punishmentList) { for (Punishment punishment : punishmentList) {
Message.sendPrefixless("WHOIS_PUNISHMENT", player, SteamwarUser.get(punishment.getPunisher()).getUserName(), punishment.getType().name(), punishment.getBantime(punishment.getStartTime(), false), punishment.getBantime(punishment.getEndTime(), punishment.isPerma()), punishment.getReason()); Message.sendPrefixless("WHOIS_PUNISHMENT", player, SteamwarUser.get(punishment.getPunisher()).getUserName(), punishment.getType().name(), punishment.getBantime(punishment.getStartTime(), false), punishment.getBantime(punishment.getEndTime(), punishment.isPerma()), punishment.getReason());
} }
} else {
for (Punishment.PunishmentType punishmentType : Punishment.PunishmentType.values()) {
if(user.isPunished(punishmentType)) {
Message.send("WHOIS_NO_PUNISHMENT", player);
continue;
}
Punishment punishment = user.getPunishment(punishmentType);
Message.sendPrefixless("WHOIS_PUNISHMENT", player, SteamwarUser.get(punishment.getPunisher()).getUserName(), punishment.getType().name(), punishment.getBantime(punishment.getStartTime(), false), punishment.getBantime(punishment.getEndTime(), punishment.isPerma()), punishment.getReason());
}
}
} }
} }

Datei anzeigen

@ -537,7 +537,7 @@ SERVER_WORLD_ERROR=§cDas Erstellen der Welt ist fehlgeschlagen.
#WhoisCommand #WhoisCommand
WHOIS_USAGE=§c/whois [Spieler/ID] WHOIS_USAGE=§c/whois [Spieler/ID] {-a}
WHOIS_USERNAME=§7Username§8: §e{0} WHOIS_USERNAME=§7Username§8: §e{0}
WHOIS_UUID=§7UUID§8: §e{0} WHOIS_UUID=§7UUID§8: §e{0}
WHOIS_UUID_HOVER=§eUUID Kopieren WHOIS_UUID_HOVER=§eUUID Kopieren
@ -549,7 +549,8 @@ WHOIS_TEAM=§7Team§8: §e[§{0}{1}§e] {2}
WHOIS_TEAM_HOVER=§e{0} anzeigen WHOIS_TEAM_HOVER=§e{0} anzeigen
WHOIS_PUNISHMENTS=§7Strafen: WHOIS_PUNISHMENTS=§7Strafen:
WHOIS_PUNISHMENT=§7{0}§8» §f§l{1}: §e{2} - {3} §f{4} WHOIS_PUNISHMENT=§7{0}§8» §f§l{1}: §e{2} - {3} §f{4}
WHOIS_NO_PUNISHMENT=§a✓ §7Der Spieler hat noch nichts getan. WHOIS_NO_PUNISHMENT=§a✓ §7Der Spieler hat keine Aktiven bestrafungen.
WHOIS_NO_ALL_PUNISHMENT=§a✓ §7Der Spieler hat noch nichts getan.
#VerifyCommand #VerifyCommand
VERIFY_USAGE=§c/verify [Code] VERIFY_USAGE=§c/verify [Code]