Paper/Spigot-API-Patches/0019-Add-BaseComponent-sendMessage-methods-to-CommandSend.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.5 KiB
Diff

From 8ae5dc71f1abb6e3a32e468bde32e1783b510380 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Tue, 8 Mar 2016 13:05:59 -0800
Subject: [PATCH] Add BaseComponent sendMessage methods to CommandSender
diff --git a/src/main/java/org/bukkit/command/CommandSender.java b/src/main/java/org/bukkit/command/CommandSender.java
index a9020ecc7..d3b3a8bf9 100644
--- a/src/main/java/org/bukkit/command/CommandSender.java
+++ b/src/main/java/org/bukkit/command/CommandSender.java
@@ -61,4 +61,30 @@ public interface CommandSender extends Permissible {
@NotNull
Spigot spigot();
// Spigot end
+
+ // Paper start
+ /**
+ * Sends the component to the sender
+ *
+ * <p>If this sender does not support sending full components then
+ * the component will be sent as legacy text.</p>
+ *
+ * @param component the component to send
+ */
+ default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
+ this.sendMessage(component.toLegacyText());
+ }
+
+ /**
+ * Sends an array of components as a single message to the sender
+ *
+ * <p>If this sender does not support sending full components then
+ * the components will be sent as legacy text.</p>
+ *
+ * @param components the components to send
+ */
+ default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
+ this.sendMessage(new net.md_5.bungee.api.chat.TextComponent(components).toLegacyText());
+ }
+ // Paper end
}
--
2.25.1