mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 04:02:50 +01:00
50 lines
3.4 KiB
Diff
50 lines
3.4 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/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
index 1f3dc7f2376854be577cb6742aa5d87d898b9882..5cb84271abdabc0f2d44ad9425828431f8818a47 100644
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
@@ -590,9 +590,9 @@ public abstract class PlayerList {
|
|
|
|
// return chatmessage;
|
|
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, io.papermc.paper.adventure.PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure
|
|
- } else if (!this.isWhiteListed(gameprofile)) {
|
|
- ichatmutablecomponent = Component.translatable("multiplayer.disconnect.not_whitelisted");
|
|
- event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.whitelistMessage)); // Spigot // Paper - Adventure
|
|
+ } else if (!this.isWhiteListed(gameprofile, event)) { // Paper - ProfileWhitelistVerifyEvent
|
|
+ //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
|
|
} else if (this.getIpBans().isBanned(socketaddress) && !this.getIpBans().get(socketaddress).hasExpired()) {
|
|
IpBanListEntry ipbanentry = this.ipBans.get(socketaddress);
|
|
|
|
@@ -961,7 +961,25 @@ public abstract class PlayerList {
|
|
}
|
|
|
|
public boolean isWhiteListed(GameProfile profile) {
|
|
- return !this.doWhiteList || this.ops.contains(profile) || this.whitelist.contains(profile);
|
|
+ // Paper start - ProfileWhitelistVerifyEvent
|
|
+ return this.isWhiteListed(profile, null);
|
|
+ }
|
|
+ public boolean isWhiteListed(GameProfile gameprofile, @Nullable org.bukkit.event.player.PlayerLoginEvent loginEvent) {
|
|
+ boolean isOp = this.ops.contains(gameprofile);
|
|
+ boolean isWhitelisted = !this.doWhiteList || isOp || this.whitelist.contains(gameprofile);
|
|
+ final com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent event;
|
|
+
|
|
+ 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);
|
|
+ event.callEvent();
|
|
+ if (!event.isWhitelisted()) {
|
|
+ if (loginEvent != null) {
|
|
+ loginEvent.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, event.kickMessage() == null ? configuredMessage : event.kickMessage());
|
|
+ }
|
|
+ return false;
|
|
+ }
|
|
+ return true;
|
|
+ // Paper end - ProfileWhitelistVerifyEvent
|
|
}
|
|
|
|
public boolean isOp(GameProfile profile) {
|