2019-07-02 12:51:06 +08:00
|
|
|
From 9e72864d6ca8bb9f8a54e80bf1f249c7828127df Mon Sep 17 00:00:00 2001
|
2017-06-18 08:53:31 +08: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
|
2019-07-02 12:51:06 +08:00
|
|
|
index e78741914..94d700e56 100644
|
2017-06-18 08:53:31 +08:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2019-05-06 11:53:47 +08:00
|
|
|
@@ -77,6 +77,7 @@ import net.minecraft.server.WorldServer;
|
|
|
|
import net.minecraft.server.WorldSettings;
|
|
|
|
import net.minecraft.server.WorldType;
|
|
|
|
import org.apache.commons.lang.Validate;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.bukkit.BanList;
|
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
@@ -148,6 +149,7 @@ import org.bukkit.craftbukkit.util.Versioning;
|
2017-06-18 08:53:31 +08:00
|
|
|
import org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions;
|
|
|
|
import org.bukkit.entity.Entity;
|
|
|
|
import org.bukkit.entity.Player;
|
2017-07-28 21:45:16 +08:00
|
|
|
+import org.bukkit.event.command.UnknownCommandEvent; // Paper
|
2017-06-18 08:53:31 +08:00
|
|
|
import org.bukkit.event.inventory.InventoryType;
|
|
|
|
import org.bukkit.event.player.PlayerChatTabCompleteEvent;
|
2017-07-28 21:45:16 +08:00
|
|
|
import org.bukkit.event.server.BroadcastMessageEvent;
|
2019-07-02 12:51:06 +08:00
|
|
|
@@ -736,7 +738,13 @@ public final class CraftServer implements Server {
|
2017-06-18 08:53:31 +08:00
|
|
|
|
|
|
|
// Spigot start
|
2018-07-18 08:08:13 +08:00
|
|
|
if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) {
|
2017-06-18 08:53:31 +08:00
|
|
|
- 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
|
|
|
|
|
|
|
|
--
|
2019-06-26 03:18:50 +08:00
|
|
|
2.22.0
|
2017-06-18 05:15:25 +08:00
|
|
|
|