2018-03-31 11:34:25 +02:00
|
|
|
From 82b87aee30bce50a525a25af11b68edf8725c1cf 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
|
2018-03-31 11:34:25 +02:00
|
|
|
index 15af94b3f..1c0c1bd81 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
|
2018-01-24 18:31:43 +01:00
|
|
|
@@ -542,9 +542,9 @@ public abstract class PlayerList {
|
2017-07-28 05:39:31 +02:00
|
|
|
|
|
|
|
// return s;
|
|
|
|
if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s); // Spigot
|
|
|
|
- } else if (!this.isWhitelisted(gameprofile)) {
|
|
|
|
+ } else if (!this.isWhitelisted(gameprofile, event)) { // Paper
|
|
|
|
// return "You are not white-listed on this server!";
|
|
|
|
- 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);
|
|
|
|
|
2018-03-31 11:34:25 +02:00
|
|
|
@@ -1209,9 +1209,25 @@ public abstract class PlayerList {
|
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);
|
|
|
|
+ }
|
|
|
|
+ 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;
|
|
|
|
}
|
|
|
|
+ // Paper end
|
|
|
|
|
|
|
|
public boolean isOp(GameProfile gameprofile) {
|
|
|
|
return this.operators.d(gameprofile) || this.server.R() && this.server.worlds.get(0).getWorldData().u() && this.server.Q().equalsIgnoreCase(gameprofile.getName()) || this.u; // CraftBukkit
|
|
|
|
--
|
2018-03-31 11:34:25 +02:00
|
|
|
2.16.3
|
2017-07-28 05:39:31 +02:00
|
|
|
|