From a19e5db5e66f39270ff96d48b2470317645f2f41 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 10 Oct 2020 23:58:34 +0200 Subject: [PATCH] Added Support for UserID --- .../bungeecore/commands/WhoisCommand.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/WhoisCommand.java b/src/de/steamwar/bungeecore/commands/WhoisCommand.java index 75a4e875..c3b6f8d4 100644 --- a/src/de/steamwar/bungeecore/commands/WhoisCommand.java +++ b/src/de/steamwar/bungeecore/commands/WhoisCommand.java @@ -40,16 +40,27 @@ public class WhoisCommand extends BasicCommand { ProxiedPlayer player = (ProxiedPlayer) sender; if(args.length == 0){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§c/whois [Spieler]"); + BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§c/whois [Spieler/ID]"); return; } SteamwarUser user = SteamwarUser.get(args[0]); if(user == null){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cUnbekannter Spieler."); + try { + int id = Integer.parseInt(args[0]); + user = SteamwarUser.get(id); + }catch (NumberFormatException ignored) {} + } + + if(user == null) { + BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cUnbekannter Spieler!"); return; } + sendUserinfo(player, user); + } + + private static void sendUserinfo(ProxiedPlayer player, SteamwarUser user) { BungeeCore.send(player, "§7Username§8: §e" + user.getUserName()); BungeeCore.send(player, "§7UUID§8: §e" + user.getUuid().toString(), "", new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, user.getUuid().toString())); BungeeCore.send(player, "§7ID§8: §e" + user.getId());