ProfileWhitelistVerifyEvent
Fires when the server is validating if a player is whitelisted. Allows you to do dynamic whitelisting and change of kick message
This commit is contained in:
@@ -5,7 +5,7 @@ Subject: [PATCH] Fix Recipe Books
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 682211cdd..1fed465bf 100644
|
||||
index 682211cdd..0f7e82d27 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
@@ -47,4 +47,26 @@ index 682211cdd..1fed465bf 100644
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
while (iterator.hasNext()) {
|
||||
packetplayinautorecipe_a = (PacketPlayInAutoRecipe.a) iterator.next();
|
||||
itemstack = this.player.inventory.getItem(packetplayinautorecipe_a.c);
|
||||
- if (this.a(packetplayinautorecipe_a.a, itemstack)) {
|
||||
+ if (this.a(packetplayinautorecipe_a.a, itemstack) && itemstack.getCount() >= packetplayinautorecipe_a.a.getCount()) { // Paper
|
||||
i = packetplayinautorecipe_a.a.getCount();
|
||||
if (itemstack.getCount() == i) {
|
||||
this.player.inventory.splitWithoutUpdate(packetplayinautorecipe_a.c);
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
|
||||
this.player.activeContainer.b(packetplayinautorecipe_a.b, packetplayinautorecipe_a.a);
|
||||
}
|
||||
+ // Paper start
|
||||
+ else {
|
||||
+ this.player.getBukkitEntity().updateInventory();
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
50
Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch
Normal file
50
Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch
Normal file
@@ -0,0 +1,50 @@
|
||||
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 c47e05c19..a038d0987 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
|
||||
// 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);
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
|
||||
}
|
||||
|
||||
+ // 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(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.R() && this.server.worlds.get(0).getWorldData().u() && this.server.Q().equalsIgnoreCase(gameprofile.getName()) || this.u; // CraftBukkit
|
||||
--
|
||||
Reference in New Issue
Block a user