2020-01-22 10:02:07 +08:00
|
|
|
From 8ecc2f468db20ab448dffd9684f101f3c2e3fa83 Mon Sep 17 00:00:00 2001
|
2016-03-09 05:16:54 +08:00
|
|
|
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
|
2020-01-22 10:02:07 +08:00
|
|
|
index 74816c63..be11d52a 100644
|
2016-03-09 05:16:54 +08:00
|
|
|
--- a/src/main/java/org/bukkit/command/CommandSender.java
|
|
|
|
+++ b/src/main/java/org/bukkit/command/CommandSender.java
|
2019-03-20 08:28:15 +08:00
|
|
|
@@ -62,4 +62,30 @@ public interface CommandSender extends Permissible {
|
|
|
|
@NotNull
|
2017-05-16 00:25:20 +08:00
|
|
|
Spigot spigot();
|
|
|
|
// Spigot end
|
2016-03-09 05:16:54 +08:00
|
|
|
+
|
|
|
|
+ // 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
|
|
|
|
+ */
|
2019-03-20 08:28:15 +08:00
|
|
|
+ default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
|
2016-03-09 05:16:54 +08:00
|
|
|
+ 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
|
|
|
|
+ */
|
2019-03-20 08:28:15 +08:00
|
|
|
+ default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
2016-03-09 05:16:54 +08:00
|
|
|
+ this.sendMessage(new net.md_5.bungee.api.chat.TextComponent(components).toLegacyText());
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
--
|
2020-01-22 10:02:07 +08:00
|
|
|
2.25.0.windows.1
|
2016-03-09 05:16:54 +08:00
|
|
|
|