13
0
geforkt von Mirrors/Paper

Add sendRichMessage and sendPlainMessage methods

Dieser Commit ist enthalten in:
Nassim Jahnke 2022-06-09 23:34:06 +02:00
Ursprung 5a75d2ebe7
Commit 44b93e65f2
2 geänderte Dateien mit 23 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -19,8 +19,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import org.bukkit.permissions.Permissible;
import org.jetbrains.annotations.NotNull;
@@ -0,0 +0,0 @@ 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));
default void sendPlainMessage(final @NotNull String message) {
this.sendMessage(net.kyori.adventure.text.Component.text(message));
}
+
+ /**

Datei anzeigen

@ -1502,6 +1502,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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));
+ }
+
+ /**
+ * Sends a message with the MiniMessage format to the command sender.
+ * <p>
+ * See <a href="https://docs.adventure.kyori.net/minimessage/">MiniMessage docs</a>
+ * for more information on the format.
+ *
+ * @param message MiniMessage content
+ */
+ default void sendRichMessage(final @NotNull String message) {
+ this.sendMessage(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(message));
+ }
+
+ /**
+ * Sends a plain message to the command sender.
+ *
+ * @param message plain message
+ */
+ default void sendPlainMessage(final @NotNull String message) {
+ this.sendMessage(net.kyori.adventure.text.Component.text(message));
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/command/PluginCommandYamlParser.java b/src/main/java/org/bukkit/command/PluginCommandYamlParser.java