diff options
Diffstat (limited to 'patches/api/0066-ProfileWhitelistVerifyEvent.patch')
-rw-r--r-- | patches/api/0066-ProfileWhitelistVerifyEvent.patch | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/patches/api/0066-ProfileWhitelistVerifyEvent.patch b/patches/api/0066-ProfileWhitelistVerifyEvent.patch index 8c653d95af..d0fac0687c 100644 --- a/patches/api/0066-ProfileWhitelistVerifyEvent.patch +++ b/patches/api/0066-ProfileWhitelistVerifyEvent.patch @@ -9,10 +9,10 @@ Allows you to do dynamic whitelisting and change of kick message diff --git a/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..52959c2d19c5b73ccd85afce6b2ab8133478f7c6 +index 0000000000000000000000000000000000000000..31884c55d45931a313292df552b604d929a22586 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java -@@ -0,0 +1,147 @@ +@@ -0,0 +1,144 @@ +/* + * Copyright (c) 2017 - Daniel Ennis (Aikar) - MIT License + * @@ -44,8 +44,8 @@ index 0000000000000000000000000000000000000000..52959c2d19c5b73ccd85afce6b2ab813 +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; ++import org.jspecify.annotations.NullMarked; ++import org.jspecify.annotations.Nullable; + +/** + * Fires when the server needs to verify if a player is whitelisted. @@ -53,24 +53,25 @@ index 0000000000000000000000000000000000000000..52959c2d19c5b73ccd85afce6b2ab813 + * Plugins may override/control the servers whitelist with this event, + * and dynamically change the kick message. + */ ++@NullMarked +public class ProfileWhitelistVerifyEvent extends Event { + + private static final HandlerList HANDLER_LIST = new HandlerList(); + -+ @NotNull private final PlayerProfile profile; ++ private final PlayerProfile profile; + private final boolean whitelistEnabled; + private final boolean isOp; + private boolean whitelisted; -+ @Nullable private Component kickMessage; ++ private @Nullable Component kickMessage; + + @Deprecated + @ApiStatus.Internal -+ public ProfileWhitelistVerifyEvent(@NotNull final PlayerProfile profile, boolean whitelistEnabled, boolean whitelisted, boolean isOp, @Nullable String kickMessage) { ++ public ProfileWhitelistVerifyEvent(final PlayerProfile profile, final boolean whitelistEnabled, final boolean whitelisted, final boolean isOp, final @Nullable String kickMessage) { + this(profile, whitelistEnabled, whitelisted, isOp, kickMessage == null ? null : LegacyComponentSerializer.legacySection().deserialize(kickMessage)); + } + + @ApiStatus.Internal -+ public ProfileWhitelistVerifyEvent(@NotNull final PlayerProfile profile, boolean whitelistEnabled, boolean whitelisted, boolean isOp, @Nullable Component kickMessage) { ++ public ProfileWhitelistVerifyEvent(final PlayerProfile profile, final boolean whitelistEnabled, final boolean whitelisted, final boolean isOp, final @Nullable Component kickMessage) { + this.profile = profile; + this.whitelistEnabled = whitelistEnabled; + this.whitelisted = whitelisted; @@ -83,8 +84,7 @@ index 0000000000000000000000000000000000000000..52959c2d19c5b73ccd85afce6b2ab813 + * @deprecated use {@link #kickMessage()} + */ + @Deprecated -+ @Nullable -+ public String getKickMessage() { ++ public @Nullable String getKickMessage() { + return this.kickMessage == null ? null : LegacyComponentSerializer.legacySection().serialize(this.kickMessage); + } + @@ -93,35 +93,33 @@ index 0000000000000000000000000000000000000000..52959c2d19c5b73ccd85afce6b2ab813 + * @deprecated Use {@link #kickMessage(Component)} + */ + @Deprecated -+ public void setKickMessage(@Nullable String kickMessage) { ++ public void setKickMessage(final @Nullable String kickMessage) { + this.kickMessage(kickMessage == null ? null : LegacyComponentSerializer.legacySection().deserialize(kickMessage)); + } + + /** + * @return the currently planned message to send to the user if they are not whitelisted + */ -+ @Nullable -+ public Component kickMessage() { ++ public @Nullable Component kickMessage() { + return this.kickMessage; + } + + /** + * @param kickMessage The message to send to the player on kick if not whitelisted. May set to {@code null} to use the server configured default + */ -+ public void kickMessage(@Nullable Component kickMessage) { ++ public void kickMessage(final @Nullable Component kickMessage) { + this.kickMessage = kickMessage; + } + + /** + * @return The profile of the player trying to connect + */ -+ @NotNull + public PlayerProfile getPlayerProfile() { + return this.profile; + } + + /** -+ * @return Whether the player is whitelisted to play on this server (whitelist may be off is why its true) ++ * @return Whether the player is whitelisted to play on this server (whitelist may be off is why it's true) + */ + public boolean isWhitelisted() { + return this.whitelisted; @@ -129,9 +127,10 @@ index 0000000000000000000000000000000000000000..52959c2d19c5b73ccd85afce6b2ab813 + + /** + * Changes the players whitelisted state. {@code false} will deny the login ++ * + * @param whitelisted The new whitelisted state + */ -+ public void setWhitelisted(boolean whitelisted) { ++ public void setWhitelisted(final boolean whitelisted) { + this.whitelisted = whitelisted; + } + @@ -149,13 +148,11 @@ index 0000000000000000000000000000000000000000..52959c2d19c5b73ccd85afce6b2ab813 + return this.whitelistEnabled; + } + -+ @NotNull + @Override + public HandlerList getHandlers() { + return HANDLER_LIST; + } + -+ @NotNull + public static HandlerList getHandlerList() { + return HANDLER_LIST; + } |