mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-15 15:15:14 +01:00
17b58d00d8
This was a useless exception wrapper that ends up making stack traces harder to read as well as the JVM cutting off the important parts Nothing catches this exception, so its safe to just get rid of it and let the REAL exception bubble down
93 lines
2.2 KiB
Diff
93 lines
2.2 KiB
Diff
From 4c16ebe8f181e90a58c0d8546eec8bed09fbb5f7 Mon Sep 17 00:00:00 2001
|
|
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
|
|
index 00000000..19d634c3
|
|
--- /dev/null
|
|
+++ b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java
|
|
@@ -0,0 +1,77 @@
|
|
+package org.bukkit.event.command;
|
|
+
|
|
+import org.bukkit.command.CommandSender;
|
|
+import org.bukkit.event.HandlerList;
|
|
+import org.bukkit.event.Event;
|
|
+
|
|
+import javax.annotation.Nullable;
|
|
+
|
|
+/**
|
|
+ * Thrown when a player executes a command that is not defined
|
|
+ */
|
|
+public class UnknownCommandEvent extends Event {
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+ private CommandSender sender;
|
|
+ private String commandLine;
|
|
+ private String message;
|
|
+
|
|
+ public UnknownCommandEvent(final CommandSender sender, final String commandLine, final String message) {
|
|
+ super(false);
|
|
+ this.sender = sender;
|
|
+ this.commandLine = commandLine;
|
|
+ this.message = message;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Gets the CommandSender or ConsoleCommandSender
|
|
+ * <p>
|
|
+ *
|
|
+ * @return Sender of the command
|
|
+ */
|
|
+ public CommandSender getSender() {
|
|
+ return sender;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Gets the command that was send
|
|
+ * <p>
|
|
+ *
|
|
+ * @return Command sent
|
|
+ */
|
|
+ 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
|
|
+ *
|
|
+ * @param message the message to be returned, or null
|
|
+ */
|
|
+ public void setMessage(String message) {
|
|
+ this.message = message;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ public static HandlerList getHandlerList() {
|
|
+ return handlers;
|
|
+ }
|
|
+}
|
|
+
|
|
--
|
|
2.20.1
|
|
|