mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 11:06:29 +01:00
57dd397155
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: b999860d SPIGOT-2304: Add LootGenerateEvent CraftBukkit Changes:77fd87e4
SPIGOT-2304: Implement LootGenerateEventa1a705ee
SPIGOT-5566: Doused campfires & fires should call EntityChangeBlockEvent41712edd
SPIGOT-5707: PersistentDataHolder not Persistent on API dropped Item
98 lines
2.4 KiB
Diff
98 lines
2.4 KiB
Diff
From d601968fd5d4787245c961ce2abe9eba0803210b 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 000000000..251342c3c
|
|
--- /dev/null
|
|
+++ b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java
|
|
@@ -0,0 +1,82 @@
|
|
+package org.bukkit.event.command;
|
|
+
|
|
+import org.bukkit.command.CommandSender;
|
|
+import org.bukkit.event.HandlerList;
|
|
+import org.bukkit.event.Event;
|
|
+
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+import org.jetbrains.annotations.Nullable;
|
|
+
|
|
+/**
|
|
+ * 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;
|
|
+ @Nullable private String message;
|
|
+
|
|
+ public UnknownCommandEvent(@NotNull final CommandSender sender, @NotNull final String commandLine, @Nullable 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
|
|
+ */
|
|
+ @NotNull
|
|
+ public CommandSender getSender() {
|
|
+ return sender;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Gets the command that was send
|
|
+ * <p>
|
|
+ *
|
|
+ * @return Command sent
|
|
+ */
|
|
+ @NotNull
|
|
+ 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(@Nullable String message) {
|
|
+ this.message = message;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ @Override
|
|
+ public HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public static HandlerList getHandlerList() {
|
|
+ return handlers;
|
|
+ }
|
|
+}
|
|
+
|
|
--
|
|
2.26.2
|
|
|