Paper/patches/server/0140-Add-UnknownCommandEvent.patch
2021-11-30 19:26:33 +01:00

26 lines
1.2 KiB
Diff

From 0000000000000000000000000000000000000000 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 de85382893132efa9c60e0c9bb0f07faaf6f442c..21b7620eb13cc297acecd7dcb2ba22fab028983a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -826,7 +826,13 @@ public final class CraftServer implements Server {
// Spigot start
if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) {
- sender.sendMessage(org.spigotmc.SpigotConfig.unknownCommandMessage);
+ // Paper start
+ org.bukkit.event.command.UnknownCommandEvent event = new org.bukkit.event.command.UnknownCommandEvent(sender, commandLine, org.spigotmc.SpigotConfig.unknownCommandMessage);
+ Bukkit.getServer().getPluginManager().callEvent(event);
+ if (event.message() != null) {
+ sender.sendMessage(event.message());
+ }
+ // Paper end
}
// Spigot end