2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2017-07-28 05:39:31 +02: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
|
2020-07-03 08:08:00 +02:00
|
|
|
index b680c6c7d8f2349928b9eebfd62f4312ec8d1180..9d05320b132679ccd511422c2c187b0d5fa89c2c 100644
|
2017-07-28 05:39:31 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
2020-06-28 10:43:47 +02:00
|
|
|
@@ -540,9 +540,9 @@ public abstract class PlayerList {
|
|
|
|
|
|
|
|
// return chatmessage;
|
2018-07-18 02:08:13 +02:00
|
|
|
if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage)); // Spigot
|
2020-06-28 10:43:47 +02:00
|
|
|
- } else if (!this.isWhitelisted(gameprofile)) {
|
|
|
|
+ } else if (!this.isWhitelisted(gameprofile, event)) { // Paper
|
2020-06-25 15:11:48 +02:00
|
|
|
chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted");
|
2017-07-28 05:39:31 +02: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);
|
|
|
|
|
2020-06-27 07:12:11 +02:00
|
|
|
@@ -923,9 +923,25 @@ public abstract class PlayerList {
|
2018-07-18 02:08:13 +02:00
|
|
|
this.server.getCommandDispatcher().a(entityplayer);
|
2017-07-28 05:39:31 +02: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-28 01:23:53 +02:00
|
|
|
}
|
2017-07-28 05:39:31 +02: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 06:12:03 +01:00
|
|
|
+ event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(MCUtil.toBukkit(gameprofile), this.hasWhitelist, isWhitelisted, isOp, org.spigotmc.SpigotConfig.whitelistMessage);
|
2017-07-28 05:39:31 +02: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-28 01:23:53 +02:00
|
|
|
+ }
|
2017-07-28 05:39:31 +02:00
|
|
|
+ // Paper end
|
|
|
|
|
|
|
|
public boolean isOp(GameProfile gameprofile) {
|
2020-06-25 15:11:48 +02:00
|
|
|
return this.operators.d(gameprofile) || this.server.a(gameprofile) && this.server.getSaveData().n() || this.v;
|