2019-06-06 15:36:57 +00:00
|
|
|
From da9d652a265b28bd8632ebbe3ba6cc86e790d61c Mon Sep 17 00:00:00 2001
|
2017-07-28 03:39:31 +00:00
|
|
|
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
|
2019-06-06 15:36:57 +00:00
|
|
|
index 1bb739b0b8..f3e228c8e2 100644
|
2017-07-28 03:39:31 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
2019-05-14 02:20:58 +00:00
|
|
|
@@ -521,9 +521,9 @@ public abstract class PlayerList {
|
2017-07-28 03:39:31 +00:00
|
|
|
|
2018-07-18 00:08:13 +00:00
|
|
|
// return chatmessage;
|
|
|
|
if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage)); // Spigot
|
2017-07-28 03:39:31 +00:00
|
|
|
- } else if (!this.isWhitelisted(gameprofile)) {
|
|
|
|
+ } else if (!this.isWhitelisted(gameprofile, event)) { // Paper
|
2018-07-18 00:08:13 +00:00
|
|
|
chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted", new Object[0]);
|
2017-07-28 03:39:31 +00:00
|
|
|
- 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);
|
|
|
|
|
2019-05-14 02:20:58 +00:00
|
|
|
@@ -892,9 +892,25 @@ public abstract class PlayerList {
|
2018-07-18 00:08:13 +00:00
|
|
|
this.server.getCommandDispatcher().a(entityplayer);
|
2017-07-28 03:39:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
public boolean isWhitelisted(GameProfile gameprofile) {
|
|
|
|
- return !this.hasWhitelist || this.operators.d(gameprofile) || this.whitelist.d(gameprofile);
|
|
|
|
+ return isWhitelisted(gameprofile, null);
|
2019-04-27 23:23:53 +00:00
|
|
|
}
|
2017-07-28 03:39:31 +00:00
|
|
|
+ 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;
|
2018-01-19 05:12:03 +00:00
|
|
|
+ event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(MCUtil.toBukkit(gameprofile), this.hasWhitelist, isWhitelisted, isOp, org.spigotmc.SpigotConfig.whitelistMessage);
|
2017-07-28 03:39:31 +00:00
|
|
|
+ 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;
|
2019-04-27 23:23:53 +00:00
|
|
|
+ }
|
2017-07-28 03:39:31 +00:00
|
|
|
+ // Paper end
|
|
|
|
|
|
|
|
public boolean isOp(GameProfile gameprofile) {
|
2019-04-27 23:23:53 +00:00
|
|
|
return this.operators.d(gameprofile) || this.server.b(gameprofile) && this.server.getWorldServer(DimensionManager.OVERWORLD).getWorldData().u() || this.u;
|
2017-07-28 03:39:31 +00:00
|
|
|
--
|
2019-03-20 01:46:00 +00:00
|
|
|
2.21.0
|
2017-07-28 03:39:31 +00:00
|
|
|
|