2017-10-05 21:38:21 +08:00
|
|
|
From 5b2ed90994ae4807e6bebb72d1743bc11004989c Mon Sep 17 00:00:00 2001
|
2017-06-18 08:53:31 +08:00
|
|
|
From: Sweepyoface <github@sweepy.pw>
|
|
|
|
Date: Sat, 17 Jun 2017 18:48:21 -0400
|
|
|
|
Subject: [PATCH] Add UnknownCommandEvent
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2017-09-07 10:59:08 +08:00
|
|
|
index cb4b78e0e..b42f4e9ee 100644
|
2017-06-18 08:53:31 +08:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
|
|
@@ -78,6 +78,7 @@ import org.bukkit.craftbukkit.util.Versioning;
|
|
|
|
import org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions;
|
|
|
|
import org.bukkit.entity.Entity;
|
|
|
|
import org.bukkit.entity.Player;
|
2017-07-28 21:45:16 +08:00
|
|
|
+import org.bukkit.event.command.UnknownCommandEvent; // Paper
|
2017-06-18 08:53:31 +08:00
|
|
|
import org.bukkit.event.inventory.InventoryType;
|
|
|
|
import org.bukkit.event.player.PlayerChatTabCompleteEvent;
|
2017-07-28 21:45:16 +08:00
|
|
|
import org.bukkit.event.server.BroadcastMessageEvent;
|
2017-09-07 10:59:08 +08:00
|
|
|
@@ -678,7 +679,13 @@ public final class CraftServer implements Server {
|
2017-06-18 08:53:31 +08:00
|
|
|
|
|
|
|
// Spigot start
|
|
|
|
if (StringUtils.isNotEmpty(org.spigotmc.SpigotConfig.unknownCommandMessage)) {
|
|
|
|
- sender.sendMessage(org.spigotmc.SpigotConfig.unknownCommandMessage);
|
|
|
|
+ // Paper start
|
|
|
|
+ UnknownCommandEvent event = new UnknownCommandEvent(sender, commandLine, org.spigotmc.SpigotConfig.unknownCommandMessage);
|
|
|
|
+ Bukkit.getServer().getPluginManager().callEvent(event);
|
|
|
|
+ if (StringUtils.isNotEmpty(event.getMessage())) {
|
|
|
|
+ sender.sendMessage(event.getMessage());
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
// Spigot end
|
|
|
|
|
|
|
|
--
|
2017-10-05 21:38:21 +08:00
|
|
|
2.14.2
|
2017-06-18 05:15:25 +08:00
|
|
|
|