From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: kashike 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 ac772bf349e0ffe9cab1df165d9460b387f2fe69..de4370233e0358da30d3704145044a99d8369f52 100644 --- a/src/main/java/org/bukkit/command/CommandSender.java +++ b/src/main/java/org/bukkit/command/CommandSender.java @@ -99,4 +99,30 @@ public interface CommandSender extends Permissible { @NotNull Spigot spigot(); // Spigot end + + // Paper start + /** + * Sends the component to the sender + * + *

If this sender does not support sending full components then + * the component will be sent as legacy text.

+ * + * @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 + * + *

If this sender does not support sending full components then + * the components will be sent as legacy text.

+ * + * @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 }