correct argument check in PlayerHandshakeEvent#setFailMessage(String) (#7940)

This commit is contained in:
Evan 2022-06-11 02:37:00 -05:00 committed by GitHub
parent ee7d16111d
commit f8beab5e5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -7,17 +7,16 @@ Subject: [PATCH] Add handshake event to allow plugins to handle client
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..0f533119af49f77b5e84a68c24b9d4e1b28663f1
index 0000000000000000000000000000000000000000..59ae7bc3a0a2079fe4b3a92d777aca682a58e4e3
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
@@ -0,0 +1,278 @@
@@ -0,0 +1,277 @@
+package com.destroystokyo.paper.event.player;
+
+import com.google.common.base.Preconditions;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
+import org.apache.commons.lang3.Validate;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
@ -274,7 +273,7 @@ index 0000000000000000000000000000000000000000..0f533119af49f77b5e84a68c24b9d4e1
+ */
+ @Deprecated
+ public void setFailMessage(@NotNull String failMessage) {
+ Preconditions.checkArgument(failMessage != null && failMessage.isEmpty(), "fail message cannot be null or empty");
+ Preconditions.checkArgument(failMessage != null && !failMessage.isEmpty(), "fail message cannot be null or empty");
+ this.failMessage(LegacyComponentSerializer.legacySection().deserialize(failMessage));
+ }
+