2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2016-03-08 21:16:54 +00: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
|
2021-02-21 19:45:33 +00:00
|
|
|
index 2588edf75483855e0c843834f39ca371770730b9..6aa795fe79ceca03c1725c36f2b0d3a63acd134e 100644
|
2016-03-08 21:16:54 +00:00
|
|
|
--- a/src/main/java/org/bukkit/command/CommandSender.java
|
|
|
|
+++ b/src/main/java/org/bukkit/command/CommandSender.java
|
2021-02-21 19:45:33 +00:00
|
|
|
@@ -1,6 +1,9 @@
|
|
|
|
package org.bukkit.command;
|
|
|
|
|
|
|
|
import java.util.UUID;
|
|
|
|
+import net.kyori.adventure.audience.MessageType;
|
|
|
|
+import net.kyori.adventure.identity.Identity;
|
|
|
|
+import net.kyori.adventure.text.Component;
|
|
|
|
import org.bukkit.Server;
|
|
|
|
import org.bukkit.permissions.Permissible;
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
@@ -117,5 +120,33 @@ public interface CommandSender extends net.kyori.adventure.audience.Audience, Pe
|
|
|
|
default void sendMessage(final @NotNull net.kyori.adventure.identity.Identity identity, final @NotNull net.kyori.adventure.text.Component message, final @NotNull net.kyori.adventure.audience.MessageType type) {
|
|
|
|
this.sendMessage(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(message));
|
|
|
|
}
|
2016-03-08 21:16:54 +00:00
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 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
|
2021-02-21 19:45:33 +00:00
|
|
|
+ * @deprecated use {@link #sendMessage(Identity, Component, MessageType)} instead
|
2016-03-08 21:16:54 +00:00
|
|
|
+ */
|
2021-02-21 19:45:33 +00:00
|
|
|
+ @Deprecated
|
2019-03-20 00:28:15 +00:00
|
|
|
+ default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
|
2016-03-08 21:16:54 +00: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
|
2021-02-21 19:45:33 +00:00
|
|
|
+ * @deprecated use {@link #sendMessage(Identity, Component, MessageType)} instead
|
2016-03-08 21:16:54 +00:00
|
|
|
+ */
|
2021-02-21 19:45:33 +00:00
|
|
|
+ @Deprecated
|
2019-03-20 00:28:15 +00:00
|
|
|
+ default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
2016-03-08 21:16:54 +00:00
|
|
|
+ this.sendMessage(new net.md_5.bungee.api.chat.TextComponent(components).toLegacyText());
|
|
|
|
+ }
|
2021-02-21 19:45:33 +00:00
|
|
|
// Paper end
|
2016-03-08 21:16:54 +00:00
|
|
|
}
|