From f1087e18c1fee8848cf68f311cdc83ed0c765a1e Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Tue, 15 Apr 2014 10:32:48 +1000 Subject: [PATCH] Fix Player Banning This issue stems from the fact that Bukkit's API only allows a UUID to be banned, but Minecraft requires both a UUID and name. To fix this we modify the code to require a UUID or a name, or both. The correct fix would be expanding the API to be able to provide a name, however this would require plugin changes. By: md_5 --- .../players/UserBanListEntry.java.patch | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/paper-server/patches/sources/net/minecraft/server/players/UserBanListEntry.java.patch b/paper-server/patches/sources/net/minecraft/server/players/UserBanListEntry.java.patch index 40e9a043fa..df038411ce 100644 --- a/paper-server/patches/sources/net/minecraft/server/players/UserBanListEntry.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/players/UserBanListEntry.java.patch @@ -5,3 +5,38 @@ package net.minecraft.server.players; import com.google.gson.JsonObject; +@@ -39,20 +40,29 @@ + + @Nullable + private static GameProfile createGameProfile(JsonObject json) { +- if (json.has("uuid") && json.has("name")) { ++ // Spigot start ++ // this whole method has to be reworked to account for the fact Bukkit only accepts UUID bans and gives no way for usernames to be stored! ++ UUID uuid = null; ++ String name = null; ++ if (json.has("uuid")) { + String s = json.get("uuid").getAsString(); + +- UUID uuid; +- + try { + uuid = UUID.fromString(s); + } catch (Throwable throwable) { +- return null; + } + +- return new GameProfile(uuid, json.get("name").getAsString()); ++ } ++ if ( json.has("name")) ++ { ++ name = json.get("name").getAsString(); ++ } ++ if ( uuid != null || name != null ) ++ { ++ return new GameProfile( uuid, name ); + } else { + return null; + } ++ // Spigot End + } + }