2021-06-11 14:02:28 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								From: Aikar <aikar@aikar.co>
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Date: Mon, 3 Jul 2017 18:11:10 -0500
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Subject: [PATCH] ProfileWhitelistVerifyEvent
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								--- a/src/main/java/net/minecraft/server/players/PlayerList.java
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								@@ -0,0 +0,0 @@ public abstract class PlayerList {
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             // return chatmessage;
							 
						 
					
						
							
								
									
										
										
										
											2023-09-21 22:35:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								             event.disallow(PlayerLoginEvent.Result.KICK_BANNED, io.papermc.paper.adventure.PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure
							 
						 
					
						
							
								
									
										
										
										
											2021-06-11 14:02:28 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								-        } else if (!this.isWhiteListed(gameprofile)) {
 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-07 22:12:48 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								-            ichatmutablecomponent = Component.translatable("multiplayer.disconnect.not_whitelisted");
 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-26 12:12:14 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								-            event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.whitelistMessage)); // Spigot // Paper - Adventure
 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-22 19:01:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+        } else if (!this.isWhiteListed(gameprofile, event)) { // Paper - ProfileWhitelistVerifyEvent
 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-07 22:12:48 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+            //ichatmutablecomponent = Component.translatable("multiplayer.disconnect.not_whitelisted"); // Paper
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+            //event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.whitelistMessage)); // Spigot // Paper - Adventure - moved to isWhitelisted
 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-12 13:18:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								         } else if (this.getIpBans().isBanned(socketaddress) && !this.getIpBans().get(socketaddress).hasExpired()) {
							 
						 
					
						
							
								
									
										
										
										
											2021-06-11 14:02:28 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								             IpBanListEntry ipbanentry = this.ipBans.get(socketaddress);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								@@ -0,0 +0,0 @@ public abstract class PlayerList {
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     public boolean isWhiteListed(GameProfile profile) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-        return !this.doWhiteList || this.ops.contains(profile) || this.whitelist.contains(profile);
 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-22 19:01:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+        // Paper start - ProfileWhitelistVerifyEvent
 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-02 05:32:05 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+        return this.isWhiteListed(profile, null);
 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-07 22:12:48 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+    }
 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-02 05:32:05 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+    public boolean isWhiteListed(GameProfile gameprofile, @Nullable org.bukkit.event.player.PlayerLoginEvent loginEvent) {
 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-11 14:02:28 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								+        boolean isOp = this.ops.contains(gameprofile);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        boolean isWhitelisted = !this.doWhiteList || isOp || this.whitelist.contains(gameprofile);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        final com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent event;
 
							 
						 
					
						
							
								
									
										
										
										
											2024-07-18 16:50:16 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+
 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-02 05:32:05 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+        final net.kyori.adventure.text.Component configuredMessage = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.whitelistMessage);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitMirror(gameprofile), this.doWhiteList, isWhitelisted, isOp, configuredMessage);
 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-11 14:02:28 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								+        event.callEvent();
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        if (!event.isWhitelisted()) {
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+            if (loginEvent != null) {
 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-02 05:32:05 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+                loginEvent.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, event.kickMessage() == null ? configuredMessage : event.kickMessage());
 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-11 14:02:28 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								+            }
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+            return false;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        }
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        return true;
 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-22 19:01:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+        // Paper end - ProfileWhitelistVerifyEvent
 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-07 22:12:48 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								     }
							 
						 
					
						
							
								
									
										
										
										
											2021-06-11 14:02:28 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     public boolean isOp(GameProfile profile) {