Paper/Spigot-Server-Patches/0214-Add-UnknownCommandEvent.patch

37 lines
1.6 KiB
Diff
Raw Normal View History

2018-01-11 06:31:19 +01:00
From e6e958afb06dc28ebe7b314e5e3c7ff83aa76419 Mon Sep 17 00:00:00 2001
2017-06-18 02:53:31 +02: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
2018-01-11 06:31:19 +01:00
index fa831dc8..8d0a9e8c 100644
2017-06-18 02:53:31 +02: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 15:45:16 +02:00
+import org.bukkit.event.command.UnknownCommandEvent; // Paper
2017-06-18 02:53:31 +02:00
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerChatTabCompleteEvent;
2017-07-28 15:45:16 +02:00
import org.bukkit.event.server.BroadcastMessageEvent;
2017-12-28 05:45:33 +01:00
@@ -675,7 +676,13 @@ public final class CraftServer implements Server {
2017-06-18 02:53:31 +02: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
--
2018-01-11 06:31:19 +01:00
2.14.3