Paper/Spigot-Server-Patches/0161-ProfileWhitelistVerifyEvent.patch
Aikar c0d07c1b67
Updated Upstream (Bukkit/CraftBukkit/Spigot)
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

Bukkit Changes:
f009c3dd SPIGOT-5810, SPIGOT-5835: 'Better' handling of Player.isOnGround
e677c370 Update ECJ version
5058a35d SPIGOT-5860: Item.setItemStack should be NotNull

CraftBukkit Changes:
d77f4d9b SPIGOT-5810, SPIGOT-5835: 'Better' handling of Player.isOnGround
53c95627 SPIGOT-5865: Piglin does not trigger EntityPickupItemEvent
2ab04d24 Update ECJ version
7884e079 SPIGOT-5868: Blocks do not tick in custom nether / end
2a848286 SPIGOT-5863: Don't check colour in scoreboard length validation
f2cbce30 SPIGOT-5866: Beehive unknown TargetReason

Spigot Changes:
ad703da0 SPIGOT-5870: /plugins "website" field shows "version"
1a27cfd8 #98: Improve output of /plugins command using text components
732d5bab Disable checkstyle in Spigot blocks
0199a9a6 #97: Add Memory Usage to Ticks Per Second Command.
33ea98fc SPIGOT-5858: NPE: Joining the server with an invalid dimension
2020-06-27 21:54:05 -04:00

47 lines
2.7 KiB
Diff

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/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 650755c0a6df59260a5f7c8cb041b2a8fe63e4a8..edb59cf7dc797384bba9d37f486b624753d4f31c 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -542,7 +542,7 @@ public abstract class PlayerList {
if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage)); // Spigot
} else if (!this.isWhitelisted(gameprofile)) {
chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted");
- event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot
+ //event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted
} else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) {
IpBanEntry ipbanentry = this.l.get(socketaddress);
@@ -923,9 +923,25 @@ public abstract class PlayerList {
this.server.getCommandDispatcher().a(entityplayer);
}
+ // Paper start
public boolean isWhitelisted(GameProfile gameprofile) {
- return !this.hasWhitelist || this.operators.d(gameprofile) || this.whitelist.d(gameprofile);
+ return isWhitelisted(gameprofile, null);
}
+ 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);
+ 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.callEvent();
+ if (!event.isWhitelisted()) {
+ if (loginEvent != null) {
+ loginEvent.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, event.getKickMessage() == null ? org.spigotmc.SpigotConfig.whitelistMessage : event.getKickMessage());
+ }
+ return false;
+ }
+ return true;
+ }
+ // Paper end
public boolean isOp(GameProfile gameprofile) {
return this.operators.d(gameprofile) || this.server.a(gameprofile) && this.server.getSaveData().n() || this.v;