mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 11:06:29 +01:00
45 lines
1.9 KiB
Diff
45 lines
1.9 KiB
Diff
From 8f7fbaba6699e1bf6d7bd89a9a805ec36b36fc05 Mon Sep 17 00:00:00 2001
|
|
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
|
|
index 69f65eec10..4077c54892 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -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;
|
|
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;
|
|
@@ -734,7 +736,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
|
|
|
|
--
|
|
2.21.0
|
|
|