Paper/Spigot-Server-Patches/0348-MC-145260-Fix-Whitelist-On-Off-inconsistency.patch
Aikar 70ad51a80c
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

My recent work on serialization is now in CraftBukkit so was able to drop the patch and Paper
is now consistent with upstream.

Bukkit Changes:
e2699636 Move API notes to more obvious location

CraftBukkit Changes:
1b2830a3 SPIGOT-4441: Fix serializing Components to and from Legacy
2020-06-02 01:29:18 -04:00

64 lines
3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 2 Mar 2019 16:12:35 -0500
Subject: [PATCH] MC-145260: Fix Whitelist On/Off inconsistency
mojang stored whitelist state in 2 places (Whitelist Object, PlayerList)
some things checked PlayerList, some checked object. This moves
everything to the Whitelist object.
https://github.com/PaperMC/Paper/issues/1880
diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java
index 8570e38f42e2f489e2899ac2f0c4a7b8dda3bb75..c97be42dd7b4c6ea2cadcc97f47185c7f02e2cce 100644
--- a/src/main/java/net/minecraft/server/JsonList.java
+++ b/src/main/java/net/minecraft/server/JsonList.java
@@ -64,6 +64,7 @@ public class JsonList<K, V extends JsonListEntry<K>> {
return this.e;
}
+ public void setEnabled(boolean flag) { this.a(flag); } // Paper - OBFHeLPER
public void a(boolean flag) {
this.e = flag;
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 53bd078594797f0e879305c14fd0731f6d348e42..88373b1081e69e8f81947682b68c40869b962b15 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -62,7 +62,7 @@ public abstract class PlayerList {
// private final Map<UUID, AdvancementDataPlayer> p;
// CraftBukkit end
public IPlayerFileData playerFileData;
- private boolean hasWhitelist;
+ //private boolean hasWhitelist;
protected final int maxPlayers;
private int viewDistance;
private EnumGamemode t;
@@ -889,9 +889,9 @@ public abstract class PlayerList {
}
public boolean isWhitelisted(GameProfile gameprofile, org.bukkit.event.player.PlayerLoginEvent loginEvent) {
boolean isOp = this.operators.d(gameprofile);
- boolean isWhitelisted = !this.hasWhitelist || isOp || this.whitelist.d(gameprofile);
+ boolean isWhitelisted = !this.getHasWhitelist() || isOp || this.whitelist.d(gameprofile);
final com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent event;
- event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(MCUtil.toBukkit(gameprofile), this.hasWhitelist, isWhitelisted, isOp, org.spigotmc.SpigotConfig.whitelistMessage);
+ event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(MCUtil.toBukkit(gameprofile), this.getHasWhitelist(), isWhitelisted, isOp, org.spigotmc.SpigotConfig.whitelistMessage);
event.callEvent();
if (!event.isWhitelisted()) {
if (loginEvent != null) {
@@ -1022,11 +1022,11 @@ public abstract class PlayerList {
}
public boolean getHasWhitelist() {
- return this.hasWhitelist;
+ return this.whitelist.isEnabled(); // Paper
}
public void setHasWhitelist(boolean flag) {
- this.hasWhitelist = flag;
+ this.whitelist.setEnabled(flag); // Paper
}
public List<EntityPlayer> b(String s) {