From 1c50d61a28aa5e0cded3303252cd61d576a52625 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 7 Jan 2022 22:03:06 +0100 Subject: [PATCH] Some minor bugfixes Signed-off-by: Lixfel --- .gitignore | 1 + src/de/steamwar/bungeecore/commands/VerifyCommand.java | 10 +++++++++- src/de/steamwar/bungeecore/sql/SteamwarUser.java | 6 ++++-- src/de/steamwar/messages/BungeeCore.properties | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index eba3be6..958dc45 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ lib .idea target +dependency-reduced-pom.xml \ No newline at end of file diff --git a/src/de/steamwar/bungeecore/commands/VerifyCommand.java b/src/de/steamwar/bungeecore/commands/VerifyCommand.java index 927c276..cbc5430 100644 --- a/src/de/steamwar/bungeecore/commands/VerifyCommand.java +++ b/src/de/steamwar/bungeecore/commands/VerifyCommand.java @@ -40,7 +40,15 @@ public class VerifyCommand extends BasicCommand { Message.send("VERIFY_USAGE", sender); return; } - byte[] bytes = Base64.getDecoder().decode(strings[0]); + + byte[] bytes; + try { + bytes = Base64.getDecoder().decode(strings[0]); + } catch (IllegalArgumentException e) { + Message.send("VERIFY_INVALID", sender); + return; + } + if(bytes.length != 16) { Message.send("VERIFY_INVALID", sender); return; diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index 86d5d02..58c53a6 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -224,10 +224,12 @@ public class SteamwarUser { final URL url = new URL(API_URL + playerName); String uuid = jsonParser.parse(new Scanner(url.openConnection().getInputStream()).nextLine()).getAsJsonObject().get("id").getAsString(); return UUID.fromString(uuid.replaceFirst("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})", "$1-$2-$3-$4-$5")); - } catch (NoSuchElementException | IOException e) { + } catch (NoSuchElementException e) { + // ignore, player does not exist + } catch (IOException e) { BungeeCore.get().getLogger().log(Level.SEVERE, "Could not get offline player UUID " + playerName, e); - return null; } + return null; } public void setTeam(int team) { diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index e0a8b7a..92875de 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -537,7 +537,7 @@ SERVER_WORLD_ERROR=§cDas Erstellen der Welt ist fehlgeschlagen. #WhoisCommand -WHOIS_USAGE=§c/whois [Spieler/ID] {-a} +WHOIS_USAGE=§c/whois [Spieler/ID] \{-a\} WHOIS_USERNAME=§7Username§8: §e{0} WHOIS_UUID=§7UUID§8: §e{0} WHOIS_UUID_HOVER=§eUUID Kopieren -- 2.39.2