mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 10:20:53 +01:00
c29c36e782
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: 3284612a SPIGOT-5853: Add DragonBattle#generateEndPortal() e4db04ae SPIGOT-5841: New map colours broken CraftBukkit Changes:d4243510
SPIGOT-5853: DragonBattle#getEndPortalLocation() throws NPE on new world1601ec31
SPIGOT-5845: ChatColor.RESET does not work in ItemMeta to reset italics4d92db6f
CraftChatMessageTest does not need AbstractTestingBase71045d3d
SPIGOT-5828: Unlock worlds on unloaddbc347b9
SPIGOT-5841: New map colours broken14053c70
SPIGOT-5847: BlockFadeEvent cannot be triggered asynchronously from another thread Spigot Changes: 6f4ff1b6 SPIGOT-5851: ChatColor (HEX) doesn't appear correctly in the ActionBar d94a518a SPIGOT-5848: PlayerSpawnLocationEvent throws NPE when setting a location of another world
47 lines
2.7 KiB
Diff
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 49d57f83dc22603b24ab2369ca4ba3a5c9e8b092..0f20704c889f28d8e7560b33d366eb8948565071 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;
|