Finish converting most of the undeprecated api to jspecify
This commit is contained in:
parent
ba3c29b92e
commit
e7e1ab56ca
45 changed files with 1046 additions and 982 deletions
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add UnknownCommandEvent
|
|||
|
||||
diff --git a/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9bdeeecdb6021d61fd9141270011e56b06a58a76
|
||||
index 0000000000000000000000000000000000000000..58fe8f60ad5e7ca0ffddebb7ba5748bbfb129ddd
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java
|
||||
@@ -0,0 +1,110 @@
|
||||
@@ -0,0 +1,105 @@
|
||||
+package org.bukkit.event.command;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
|
@ -19,22 +19,23 @@ index 0000000000000000000000000000000000000000..9bdeeecdb6021d61fd9141270011e56b
|
|||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown when a player executes a command that is not defined
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class UnknownCommandEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final CommandSender sender;
|
||||
+ @NotNull private final String commandLine;
|
||||
+ @Nullable private Component message;
|
||||
+ private final CommandSender sender;
|
||||
+ private final String commandLine;
|
||||
+ private @Nullable Component message;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public UnknownCommandEvent(@NotNull final CommandSender sender, @NotNull final String commandLine, @Nullable final Component message) {
|
||||
+ public UnknownCommandEvent(final CommandSender sender, final String commandLine, final @Nullable Component message) {
|
||||
+ super(false);
|
||||
+ this.sender = sender;
|
||||
+ this.commandLine = commandLine;
|
||||
|
@ -46,7 +47,6 @@ index 0000000000000000000000000000000000000000..9bdeeecdb6021d61fd9141270011e56b
|
|||
+ *
|
||||
+ * @return Sender of the command
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public CommandSender getSender() {
|
||||
+ return this.sender;
|
||||
+ }
|
||||
|
@ -56,7 +56,6 @@ index 0000000000000000000000000000000000000000..9bdeeecdb6021d61fd9141270011e56b
|
|||
+ *
|
||||
+ * @return Command sent
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getCommandLine() {
|
||||
+ return this.commandLine;
|
||||
+ }
|
||||
|
@ -67,9 +66,8 @@ index 0000000000000000000000000000000000000000..9bdeeecdb6021d61fd9141270011e56b
|
|||
+ * @return Unknown command message
|
||||
+ * @deprecated use {@link #message()}
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ @Deprecated
|
||||
+ public String getMessage() {
|
||||
+ public @Nullable String getMessage() {
|
||||
+ return this.message == null ? null : LegacyComponentSerializer.legacySection().serialize(this.message);
|
||||
+ }
|
||||
+
|
||||
|
@ -91,9 +89,8 @@ index 0000000000000000000000000000000000000000..9bdeeecdb6021d61fd9141270011e56b
|
|||
+ *
|
||||
+ * @return Unknown command message
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ @Contract(pure = true)
|
||||
+ public Component message() {
|
||||
+ public @Nullable Component message() {
|
||||
+ return this.message;
|
||||
+ }
|
||||
+
|
||||
|
@ -108,13 +105,11 @@ index 0000000000000000000000000000000000000000..9bdeeecdb6021d61fd9141270011e56b
|
|||
+ this.message = message;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue