From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Sweepyoface 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 2eb2c0c93b0d67ad7474e37158dab44018c9cbac..3e3f2a3d3b5ab32f498b4dd65f35f4c26470790f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -105,6 +105,7 @@ import net.minecraft.server.WorldNBTStorage; import net.minecraft.server.WorldServer; import net.minecraft.server.WorldSettings; import org.apache.commons.lang.Validate; +import org.apache.commons.lang3.StringUtils; import org.bukkit.BanList; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -178,6 +179,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; @@ -786,7 +788,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