Fix calling UnknownCommandEvent (#8232)

This commit is contained in:
Jake Potrebic
2023-02-16 18:07:30 -08:00
parent 8242b76d95
commit 5d777995f4
3 changed files with 91 additions and 9 deletions

View File

@@ -17,6 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.bukkit.command.CommandSender;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
@@ -29,11 +30,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @NotNull private String commandLine;
+ @Nullable private Component message;
+
+ @Deprecated
+ public UnknownCommandEvent(@NotNull final CommandSender sender, @NotNull final String commandLine, @Nullable final String message) {
+ this(sender, commandLine, message == null ? null : LegacyComponentSerializer.legacySection().deserialize(message));
+ }
+
+ public UnknownCommandEvent(@NotNull final CommandSender sender, @NotNull final String commandLine, @Nullable final Component message) {
+ super(false);
+ this.sender = sender;
@@ -96,6 +92,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @return Unknown command message
+ */
+ @Nullable
+ @Contract(pure = true)
+ public Component message() {
+ return this.message;
+ }