Paper/Spigot-Server-Patches/0155-Add-UnknownCommandEvent.patch
Aikar e4d10a6d67
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
122289ff Add FaceAttachable interface to handle Grindstone facing in common with Switches
a6db750e SPIGOT-5647: ZombieVillager entity should have getVillagerType()

CraftBukkit Changes:
bbe3d58e SPIGOT-5650: Lectern.setPage(int) causes a NullPointerException
3075579f Add FaceAttachable interface to handle Grindstone facing in common with Switches
95bd4238 SPIGOT-5647: ZombieVillager entity should have getVillagerType()
4d975ac3 SPIGOT-5617: setBlockData does not work when NotPlayEvent is called by redstone current
2020-04-02 17:09:17 -04:00

45 lines
1.9 KiB
Diff

From d8637d8eaf04e7f109b77ef684fa51fc7c06a206 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 742c21480a..1f1af567b4 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -79,6 +79,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;
@@ -150,6 +151,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;
@@ -750,7 +752,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.25.1