From 02819929b61183373d5ed13d05c53870bea43b23 Mon Sep 17 00:00:00 2001 From: SageSphinx63920 <sage@sagesphinx63920.dev> Date: Sun, 14 May 2023 12:57:15 +0200 Subject: [PATCH] Add whitelist events --- .../server/players/UserWhiteList.java.patch | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 paper-server/patches/sources/net/minecraft/server/players/UserWhiteList.java.patch diff --git a/paper-server/patches/sources/net/minecraft/server/players/UserWhiteList.java.patch b/paper-server/patches/sources/net/minecraft/server/players/UserWhiteList.java.patch new file mode 100644 index 0000000000..4cef2c2bc4 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/server/players/UserWhiteList.java.patch @@ -0,0 +1,26 @@ +--- a/net/minecraft/server/players/UserWhiteList.java ++++ b/net/minecraft/server/players/UserWhiteList.java +@@ -28,4 +28,23 @@ + protected String getKeyForUser(GameProfile gameProfile) { + return gameProfile.getId().toString(); + } ++ // Paper start - Add whitelist events ++ @Override ++ public void add(UserWhiteListEntry entry) { ++ if (!new io.papermc.paper.event.server.WhitelistStateUpdateEvent(com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitCopy(entry.getUser()), io.papermc.paper.event.server.WhitelistStateUpdateEvent.WhitelistStatus.ADDED).callEvent()) { ++ return; ++ } ++ ++ super.add(entry); ++ } ++ ++ @Override ++ public void remove(GameProfile profile) { ++ if (!new io.papermc.paper.event.server.WhitelistStateUpdateEvent(com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitCopy(profile), io.papermc.paper.event.server.WhitelistStateUpdateEvent.WhitelistStatus.REMOVED).callEvent()) { ++ return; ++ } ++ ++ super.remove(profile); ++ } ++ // Paper end - Add whitelist events + }