2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2017-06-18 00:53:31 +00: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
|
2020-09-10 23:47:58 +00:00
|
|
|
index 3e7048365d04b0ac17a70e964950abd9597ce37e..474bbbbd2adca0e504d351b581f4cb544a8d41e3 100644
|
2017-06-18 00:53:31 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2020-08-25 02:22:08 +00:00
|
|
|
@@ -104,6 +104,7 @@ import net.minecraft.server.WorldNBTStorage;
|
2020-06-25 13:11:48 +00:00
|
|
|
import net.minecraft.server.WorldServer;
|
2019-05-06 03:53:47 +00:00
|
|
|
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;
|
2020-08-25 02:22:08 +00:00
|
|
|
@@ -176,6 +177,7 @@ import org.bukkit.craftbukkit.util.Versioning;
|
2017-06-18 00:53:31 +00:00
|
|
|
import org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions;
|
|
|
|
import org.bukkit.entity.Entity;
|
|
|
|
import org.bukkit.entity.Player;
|
2017-07-28 13:45:16 +00:00
|
|
|
+import org.bukkit.event.command.UnknownCommandEvent; // Paper
|
2017-06-18 00:53:31 +00:00
|
|
|
import org.bukkit.event.inventory.InventoryType;
|
|
|
|
import org.bukkit.event.player.PlayerChatTabCompleteEvent;
|
2017-07-28 13:45:16 +00:00
|
|
|
import org.bukkit.event.server.BroadcastMessageEvent;
|
2020-08-25 02:22:08 +00:00
|
|
|
@@ -784,7 +786,13 @@ public final class CraftServer implements Server {
|
2017-06-18 00:53:31 +00:00
|
|
|
|
|
|
|
// Spigot start
|
2018-07-18 00:08:13 +00:00
|
|
|
if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) {
|
2017-06-18 00:53:31 +00: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
|
|
|
|
|