[ci skip] Cleanup events (#10202)

This commit is contained in:
Lulu13022002 2024-02-01 10:15:57 +01:00 committed by GitHub
parent b3c81089ae
commit 294347bee2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
295 changed files with 3245 additions and 3088 deletions

View file

@ -6,7 +6,7 @@ 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..e4f8a0d14ae66468bbb0a5d6bf9c1ee417dc866c
index 0000000000000000000000000000000000000000..9bdeeecdb6021d61fd9141270011e56b06a58a76
--- /dev/null
+++ b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java
@@ -0,0 +1,110 @@
@ -17,6 +17,7 @@ index 0000000000000000000000000000000000000000..e4f8a0d14ae66468bbb0a5d6bf9c1ee4
+import org.bukkit.command.CommandSender;
+import org.bukkit.event.Event;
+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;
@ -25,11 +26,14 @@ index 0000000000000000000000000000000000000000..e4f8a0d14ae66468bbb0a5d6bf9c1ee4
+ * Thrown when a player executes a command that is not defined
+ */
+public class UnknownCommandEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+ @NotNull private CommandSender sender;
+ @NotNull private String commandLine;
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @NotNull private final CommandSender sender;
+ @NotNull private final String commandLine;
+ @Nullable private Component message;
+
+ @ApiStatus.Internal
+ public UnknownCommandEvent(@NotNull final CommandSender sender, @NotNull final String commandLine, @Nullable final Component message) {
+ super(false);
+ this.sender = sender;
@ -39,29 +43,26 @@ index 0000000000000000000000000000000000000000..e4f8a0d14ae66468bbb0a5d6bf9c1ee4
+
+ /**
+ * Gets the CommandSender or ConsoleCommandSender
+ * <p>
+ *
+ * @return Sender of the command
+ */
+ @NotNull
+ public CommandSender getSender() {
+ return sender;
+ return this.sender;
+ }
+
+ /**
+ * Gets the command that was send
+ * <p>
+ * Gets the command that was sent
+ *
+ * @return Command sent
+ */
+ @NotNull
+ public String getCommandLine() {
+ return commandLine;
+ return this.commandLine;
+ }
+
+ /**
+ * Gets message that will be returned
+ * <p>
+ *
+ * @return Unknown command message
+ * @deprecated use {@link #message()}
@ -75,9 +76,9 @@ index 0000000000000000000000000000000000000000..e4f8a0d14ae66468bbb0a5d6bf9c1ee4
+ /**
+ * Sets message that will be returned
+ * <p>
+ * Set to null to avoid any message being sent
+ * Set to {@code null} to avoid any message being sent
+ *
+ * @param message the message to be returned, or null
+ * @param message the message to be returned, or {@code null}
+ * @deprecated use {@link #message(Component)}
+ */
+ @Deprecated
@ -87,7 +88,6 @@ index 0000000000000000000000000000000000000000..e4f8a0d14ae66468bbb0a5d6bf9c1ee4
+
+ /**
+ * Gets message that will be returned
+ * <p>
+ *
+ * @return Unknown command message
+ */
@ -100,9 +100,9 @@ index 0000000000000000000000000000000000000000..e4f8a0d14ae66468bbb0a5d6bf9c1ee4
+ /**
+ * Sets message that will be returned
+ * <p>
+ * Set to null to avoid any message being sent
+ * Set to {@code null} to avoid any message being sent
+ *
+ * @param message the message to be returned, or null
+ * @param message the message to be returned, or {@code null}
+ */
+ public void message(@Nullable Component message) {
+ this.message = message;
@ -111,12 +111,12 @@ index 0000000000000000000000000000000000000000..e4f8a0d14ae66468bbb0a5d6bf9c1ee4
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+}
+