From 0df03a7dfbbde46d9f34f028191cb6fdcd0e0f54 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Wed, 29 Nov 2023 17:20:19 +0100 Subject: [PATCH] Star fixes, whois ID based only ADMINISTRATION, Prefix Signed-off-by: Lixfel --- .../bungeecore/commands/WhoisCommand.java | 37 +++++++++++-------- .../steamwar/messages/BungeeCore.properties | 3 +- .../messages/BungeeCore_de.properties | 1 + 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/WhoisCommand.java b/src/de/steamwar/bungeecore/commands/WhoisCommand.java index beb1e2a..413fb0c 100644 --- a/src/de/steamwar/bungeecore/commands/WhoisCommand.java +++ b/src/de/steamwar/bungeecore/commands/WhoisCommand.java @@ -48,28 +48,33 @@ public class WhoisCommand extends SWCommand { @Register(description = "WHOIS_USAGE") public void genericCommand(ProxiedPlayer player, @Mapper("player") String target, WhoisParameterTypes... parameters) { + ChatSender sender = ChatSender.of(player); SteamwarUser user = SteamwarUser.get(target); - if (user == null) { - try { - int id = Integer.parseInt(target); - user = SteamwarUser.get(id); - } catch (NumberFormatException ignored) { + if (sender.user().hasPerm(UserPerm.ADMINISTRATION)) { + if (user == null) { + try { + int id = Integer.parseInt(target); + user = SteamwarUser.get(id); + } catch (NumberFormatException ignored) { + // Ignored + } } - } - if (user == null) { - try { - long id = Long.parseLong(target); - user = SteamwarUser.get(id); - } catch (NumberFormatException ignored) { - // Ignored + + if (user == null) { + try { + long id = Long.parseLong(target); + user = SteamwarUser.get(id); + } catch (NumberFormatException ignored) { + // Ignored + } } } if (user == null) { - Message.send("UNKNOWN_PLAYER", player); + sender.system("UNKNOWN_PLAYER"); } else { EnumSet set = parameters.length == 0 ? EnumSet.noneOf(WhoisParameterTypes.class) : EnumSet.copyOf(Arrays.asList(parameters)); - sendUserinfo(player, user, set); + sendUserinfo(sender, user, set); } } @@ -78,11 +83,11 @@ public class WhoisCommand extends SWCommand { return SWCommandUtils.createMapper(s -> s, s -> BungeeCord.getInstance().getPlayers().stream().map(ProxiedPlayer::getName).collect(Collectors.toList())); } - private static void sendUserinfo(ProxiedPlayer player, SteamwarUser user, EnumSet parameterTypes) { - ChatSender sender = ChatSender.of(player); + private static void sendUserinfo(ChatSender sender, SteamwarUser user, EnumSet parameterTypes) { Team team = Team.get(user.getTeam()); sender.system("WHOIS_USERNAME", user.getUserName()); + sender.system("WHOIS_PREFIX", user.prefix().getChatPrefix()); sender.system("WHOIS_TEAM", new Message("WHOIS_TEAM_HOVER", team.getTeamName()), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team info " + team.getTeamKuerzel()), team.getTeamColor(), team.getTeamKuerzel(), team.getTeamName()); if (!sender.user().hasPerm(UserPerm.TEAM)) diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index b6982db..c038809 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -380,7 +380,7 @@ TUTORIAL_NAME=§e{0} TUTORIAL_BY=§8von §7{0} TUTORIAL_STARS=§e{0} §7Stars TUTORIAL_RATE_TITLE=Rate tutorial -TUTORIAL_RATE=§e{0} §7Star(e) +TUTORIAL_RATE=§e{0} §7Star(s) TUTORIAL_DELETE=§cDelete with Shift+Right-Click TUTORIAL_CREATE_HELP=§8/§7tutorial create §8[§ematerial§8] §8[§ename§8] TUTORIAL_CREATE_MISSING=§cA tutorial can only be created on a tutorial server! @@ -598,6 +598,7 @@ SERVER_WORLD_ERROR=§cCreating the world failed. #WhoisCommand WHOIS_USAGE=§c/whois [player/ID] [-a/-m] WHOIS_USERNAME=§7Username§8: §e{0} +WHOIS_PREFIX=§7Chat-Prefix§8: {0} WHOIS_UUID=§7UUID§8: §e{0} WHOIS_UUID_HOVER=§eCopy UUID WHOIS_ID=§7ID§8: §e{0} diff --git a/src/de/steamwar/messages/BungeeCore_de.properties b/src/de/steamwar/messages/BungeeCore_de.properties index bce5de7..e396bdb 100644 --- a/src/de/steamwar/messages/BungeeCore_de.properties +++ b/src/de/steamwar/messages/BungeeCore_de.properties @@ -576,6 +576,7 @@ SERVER_WORLD_ERROR=§cDas Erstellen der Welt ist fehlgeschlagen. #WhoisCommand WHOIS_USAGE=§c/whois [Spieler/ID] [-a/-m] WHOIS_USERNAME=§7Username§8: §e{0} +WHOIS_PREFIX=§7Chat-Präfix§8: {0} WHOIS_PERMS=§7Rechte§8: §7{0} WHOIS_UUID=§7UUID§8: §e{0} WHOIS_UUID_HOVER=§eUUID Kopieren