aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0361-MC-145260-Fix-Whitelist-On-Off-inconsistency.patch
blob: 09b1033eba3d0f3727f1292db28532b61dce47cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
From f936e3036737be2b1248454ca5569fb2d32f4a2c 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 8570e38f42..c97be42dd7 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 52aa83f51f..0da3f95f89 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;
@@ -899,9 +899,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) {
@@ -1030,11 +1030,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) {
-- 
2.22.0