2018-11-24 06:28:04 +01:00
|
|
|
From 4f2293cad7b7ebfdea3f2d98d6de482f59bc9fff Mon Sep 17 00:00:00 2001
|
2016-03-08 22:16:54 +01: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
|
2018-07-29 18:42:07 +02:00
|
|
|
index abf68a2c7..fcb03b830 100644
|
2016-03-08 22:16:54 +01:00
|
|
|
--- a/src/main/java/org/bukkit/command/CommandSender.java
|
|
|
|
+++ b/src/main/java/org/bukkit/command/CommandSender.java
|
2017-05-15 18:25:20 +02:00
|
|
|
@@ -58,4 +58,30 @@ public interface CommandSender extends Permissible {
|
|
|
|
|
|
|
|
Spigot spigot();
|
|
|
|
// Spigot end
|
2016-03-08 22:16:54 +01: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
|
|
|
|
+ */
|
|
|
|
+ default void sendMessage(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(net.md_5.bungee.api.chat.BaseComponent... components) {
|
|
|
|
+ this.sendMessage(new net.md_5.bungee.api.chat.TextComponent(components).toLegacyText());
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
2018-11-24 06:28:04 +01:00
|
|
|
index b57b6981d..2096656ee 100644
|
2016-03-08 22:16:54 +01:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Player.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Player.java
|
2018-11-24 06:28:04 +01:00
|
|
|
@@ -421,6 +421,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
2016-03-08 22:16:54 +01:00
|
|
|
*
|
|
|
|
* @param component the components to send
|
|
|
|
*/
|
|
|
|
+ @Override
|
2016-12-20 23:34:27 +01:00
|
|
|
public default void sendMessage(net.md_5.bungee.api.chat.BaseComponent component) {
|
|
|
|
spigot().sendMessage(component);
|
|
|
|
}
|
2018-11-24 06:28:04 +01:00
|
|
|
@@ -430,6 +431,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
2016-03-08 22:16:54 +01:00
|
|
|
*
|
|
|
|
* @param components the components to send
|
|
|
|
*/
|
|
|
|
+ @Override
|
2016-12-20 23:34:27 +01:00
|
|
|
public default void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components) {
|
|
|
|
spigot().sendMessage(components);
|
|
|
|
}
|
2016-03-08 22:16:54 +01:00
|
|
|
--
|
2018-11-03 01:23:27 +01:00
|
|
|
2.19.1
|
2016-03-08 22:16:54 +01:00
|
|
|
|