Add UnknownCommandEvent

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
This commit is contained in:
Sweepyoface
2017-06-17 18:48:21 -04:00
parent bb90110894
commit 551d6ee71e
3 changed files with 67 additions and 35 deletions

View File

@ -950,7 +950,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, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.unknownCommandMessage));
this.getPluginManager().callEvent(event);
if (event.message() != null) {
sender.sendMessage(event.message());
}
// Paper end
}
// Spigot end