2020-01-22 02:02:07 +00:00
|
|
|
From 7d8324440f38691b133a6173eec32ffff6764533 Mon Sep 17 00:00:00 2001
|
2017-06-18 00:53:31 +00:00
|
|
|
From: Sweepyoface <github@sweepy.pw>
|
|
|
|
Date: Sat, 17 Jun 2017 18:48:06 -0400
|
|
|
|
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
|
2020-01-22 02:02:07 +00:00
|
|
|
index 00000000..251342c3
|
2017-06-18 00:53:31 +00:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java
|
2019-03-20 00:28:15 +00:00
|
|
|
@@ -0,0 +1,82 @@
|
2017-06-18 00:53:31 +00:00
|
|
|
+package org.bukkit.event.command;
|
|
|
|
+
|
|
|
|
+import org.bukkit.command.CommandSender;
|
|
|
|
+import org.bukkit.event.HandlerList;
|
|
|
|
+import org.bukkit.event.Event;
|
|
|
|
+
|
2019-03-20 00:28:15 +00:00
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
|
|
+import org.jetbrains.annotations.Nullable;
|
2017-06-18 00:53:31 +00:00
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Thrown when a player executes a command that is not defined
|
|
|
|
+ */
|
|
|
|
+public class UnknownCommandEvent extends Event {
|
|
|
|
+ private static final HandlerList handlers = new HandlerList();
|
2019-03-20 00:28:15 +00:00
|
|
|
+ @NotNull private CommandSender sender;
|
|
|
|
+ @NotNull private String commandLine;
|
|
|
|
+ @Nullable private String message;
|
2017-06-18 00:53:31 +00:00
|
|
|
+
|
2019-03-20 00:28:15 +00:00
|
|
|
+ public UnknownCommandEvent(@NotNull final CommandSender sender, @NotNull final String commandLine, @Nullable final String message) {
|
2017-06-18 00:53:31 +00:00
|
|
|
+ super(false);
|
|
|
|
+ this.sender = sender;
|
|
|
|
+ this.commandLine = commandLine;
|
|
|
|
+ this.message = message;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Gets the CommandSender or ConsoleCommandSender
|
|
|
|
+ * <p>
|
|
|
|
+ *
|
|
|
|
+ * @return Sender of the command
|
|
|
|
+ */
|
2019-03-20 00:28:15 +00:00
|
|
|
+ @NotNull
|
2017-06-18 00:53:31 +00:00
|
|
|
+ public CommandSender getSender() {
|
|
|
|
+ return sender;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Gets the command that was send
|
|
|
|
+ * <p>
|
|
|
|
+ *
|
|
|
|
+ * @return Command sent
|
|
|
|
+ */
|
2019-03-20 00:28:15 +00:00
|
|
|
+ @NotNull
|
2017-06-18 00:53:31 +00:00
|
|
|
+ public String getCommandLine() {
|
|
|
|
+ return commandLine;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Gets message that will be returned
|
|
|
|
+ * <p>
|
|
|
|
+ *
|
|
|
|
+ * @return Unknown command message
|
|
|
|
+ */
|
|
|
|
+ @Nullable
|
|
|
|
+ public String getMessage() {
|
|
|
|
+ return message;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Sets message that will be returned
|
|
|
|
+ * <p>
|
|
|
|
+ * Set to null to avoid any message being sent
|
2017-07-03 15:38:49 +00:00
|
|
|
+ *
|
|
|
|
+ * @param message the message to be returned, or null
|
2017-06-18 00:53:31 +00:00
|
|
|
+ */
|
2019-03-20 00:28:15 +00:00
|
|
|
+ public void setMessage(@Nullable String message) {
|
2017-06-18 00:53:31 +00:00
|
|
|
+ this.message = message;
|
|
|
|
+ }
|
|
|
|
+
|
2019-03-20 00:28:15 +00:00
|
|
|
+ @NotNull
|
2017-06-18 00:53:31 +00:00
|
|
|
+ @Override
|
|
|
|
+ public HandlerList getHandlers() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+
|
2019-03-20 00:28:15 +00:00
|
|
|
+ @NotNull
|
2017-06-18 00:53:31 +00:00
|
|
|
+ public static HandlerList getHandlerList() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
--
|
2020-01-22 02:02:07 +00:00
|
|
|
2.25.0.windows.1
|
2017-06-18 00:53:31 +00:00
|
|
|
|