mirror of
https://github.com/PaperMC/Paper.git
synced 2024-08-20 11:22:56 +02:00
Allows us much greater control over the Spigot portion of the code and makes us more "proper" Credit to @Dmck2b for originally passing the idea along a while back
50 lines
1.9 KiB
Diff
50 lines
1.9 KiB
Diff
From a6c5c80d264dd85fb8d188a3870e39c7c6312e55 Mon Sep 17 00:00:00 2001
|
|
From: md_5 <git@md-5.net>
|
|
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.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/GameProfileBanEntry.java b/src/main/java/net/minecraft/server/GameProfileBanEntry.java
|
|
index 2943244..84f889a 100644
|
|
--- a/src/main/java/net/minecraft/server/GameProfileBanEntry.java
|
|
+++ b/src/main/java/net/minecraft/server/GameProfileBanEntry.java
|
|
@@ -29,20 +29,29 @@ public class GameProfileBanEntry extends ExpirableListEntry {
|
|
}
|
|
|
|
private static GameProfile b(JsonObject jsonobject) {
|
|
- if (jsonobject.has("uuid") && jsonobject.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 (jsonobject.has("uuid")) {
|
|
String s = jsonobject.get("uuid").getAsString();
|
|
|
|
- UUID uuid;
|
|
-
|
|
try {
|
|
uuid = UUID.fromString(s);
|
|
} catch (Throwable throwable) {
|
|
- return null;
|
|
}
|
|
|
|
- return new GameProfile(uuid, jsonobject.get("name").getAsString());
|
|
+ }
|
|
+ if ( jsonobject.has("name"))
|
|
+ {
|
|
+ name = jsonobject.get("name").getAsString();
|
|
+ }
|
|
+ if ( uuid != null || name != null )
|
|
+ {
|
|
+ return new GameProfile( uuid, name );
|
|
} else {
|
|
return null;
|
|
}
|
|
+ // Spigot End
|
|
}
|
|
}
|
|
--
|
|
1.9.1
|
|
|