Fix NPE when temp ip bans expire (#3373)

Dieser Commit ist enthalten in:
Josh Roy 2020-05-16 23:26:49 -04:00 committet von GitHub
Ursprung 16bd420db5
Commit fc9cf84dc6
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -98,3 +98,16 @@ index 734e7ecf630aa13a30d72ff96e57e5d0faf35013..8570e38f42e2f489e2899ac2f0c4a7b8
Collection<V> collection = this.d.values();
String s = this.b.toJson(collection);
BufferedWriter bufferedwriter = null;
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index b69cff40922ba2d1a44c11bcae86f9439130ad96..22f18be4627fefe500239f7a35eee3b019bcffcc 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -512,7 +512,7 @@ public abstract class PlayerList {
} else if (!this.isWhitelisted(gameprofile, event)) { // Paper
chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted", new Object[0]);
//event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted
- } else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) {
+ } else if (getIPBans().isBanned(socketaddress) && getIPBans().get(socketaddress) != null && !getIPBans().get(socketaddress).hasExpired()) { // Paper - fix NPE with temp ip bans
IpBanEntry ipbanentry = this.l.get(socketaddress);
chatmessage = new ChatMessage("multiplayer.disconnect.banned_ip.reason", new Object[]{ipbanentry.getReason()});