Archiviert
1
0

Merge pull request 'Add Only Active Punishments on Whois' (#288) from active_punishments into master

Reviewed-on: SteamWar/BungeeCore#288
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Lixfel 2021-12-30 22:11:54 +01:00
Commit 90e1148eb1
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");
}
sendUserinfo(player, user, all);
} }
private static void sendUserinfo(ProxiedPlayer player, SteamwarUser user) { 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);
List<Punishment> punishmentList = Punishment.getAllPunishmentsOfPlayer(user.getId()); if(all) {
if(punishmentList.isEmpty()) { List<Punishment> punishmentList = Punishment.getAllPunishmentsOfPlayer(user.getId());
Message.send("WHOIS_NO_PUNISHMENT", player); if(punishmentList.isEmpty()) {
return; Message.send("WHOIS_NO_ALL_PUNISHMENT", player);
} return;
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()); 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());
}
} 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 Strafen.
WHOIS_NO_ALL_PUNISHMENT=§a✓ §7Der Spieler hat noch nichts getan.
#VerifyCommand #VerifyCommand
VERIFY_USAGE=§c/verify [Code] VERIFY_USAGE=§c/verify [Code]