37 lines
1.6 KiB
Diff
37 lines
1.6 KiB
Diff
From 7b5147f0f06ece4202a78ae8391ce5faef0ad8af Mon Sep 17 00:00:00 2001
|
|
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
|
|
index 89ff2fb53..f82ab97e6 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -83,6 +83,7 @@ import org.bukkit.craftbukkit.util.Versioning;
|
|
import org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions;
|
|
import org.bukkit.entity.Entity;
|
|
import org.bukkit.entity.Player;
|
|
+import org.bukkit.event.command.UnknownCommandEvent; // Paper
|
|
import org.bukkit.event.inventory.InventoryType;
|
|
import org.bukkit.event.player.PlayerChatTabCompleteEvent;
|
|
import org.bukkit.event.server.BroadcastMessageEvent;
|
|
@@ -732,7 +733,13 @@ public final class CraftServer implements Server {
|
|
|
|
// Spigot start
|
|
if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) {
|
|
- 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
|
|
|
|
--
|
|
2.20.1
|
|
|