mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-02 17:01:38 +01:00
c2f872aed3
Importing the full library would double the jar size... its way too large. So lets just import the basic int/long based collections to then use to improve performance on these kind of collections.
65 lines
2.3 KiB
Diff
65 lines
2.3 KiB
Diff
From 2f744e6d6116fd4debbba556368e44db6d1b9090 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 148756b..4ad0028 100644
|
|
--- a/src/main/java/org/bukkit/command/CommandSender.java
|
|
+++ b/src/main/java/org/bukkit/command/CommandSender.java
|
|
@@ -32,4 +32,30 @@ public interface CommandSender extends Permissible {
|
|
* @return Name of the sender
|
|
*/
|
|
public String getName();
|
|
+
|
|
+ // 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
|
|
index 5326ea6..2951b98 100644
|
|
--- a/src/main/java/org/bukkit/entity/Player.java
|
|
+++ b/src/main/java/org/bukkit/entity/Player.java
|
|
@@ -338,6 +338,7 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
|
|
*
|
|
* @param component the components to send
|
|
*/
|
|
+ @Override
|
|
public void sendMessage(net.md_5.bungee.api.chat.BaseComponent component);
|
|
|
|
/**
|
|
@@ -345,6 +346,7 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
|
|
*
|
|
* @param components the components to send
|
|
*/
|
|
+ @Override
|
|
public void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components);
|
|
|
|
/**
|
|
--
|
|
2.8.0
|
|
|