testserver/Spigot-API-Patches/0041-Add-String-based-Actio...

74 lines
3.6 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2016-12-20 20:56:41 +00:00
From: Aikar <aikar@aikar.co>
Date: Tue, 20 Dec 2016 15:55:55 -0500
Subject: [PATCH] Add String based Action Bar API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
2020-06-25 02:33:35 +00:00
index 0a9d2b1914a059fd3a247ca48e6bef9554d2cf16..3b6f08209d8882cda5593305936474e3bc975f3d 100644
2016-12-20 20:56:41 +00:00
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
2020-06-25 02:33:35 +00:00
@@ -469,6 +469,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
public void sendMap(@NotNull MapView map);
2016-12-20 20:56:41 +00:00
// Paper start
+
+ /**
+ * Sends an Action Bar message to the client.
+ *
+ * Use Section symbols for legacy color codes to send formatting.
+ *
+ * @param message The message to send
+ */
+ public void sendActionBar(@NotNull String message);
+
+ /**
+ * Sends an Action Bar message to the client.
+ *
+ * Use supplied alternative character to the section symbol to represent legacy color codes.
+ *
+ * @param alternateChar Alternate symbol such as '&'
+ * @param message The message to send
+ */
+ public void sendActionBar(char alternateChar, @NotNull String message);
+
2016-12-20 20:56:41 +00:00
/**
* Sends the component to the player
*
2020-06-25 02:33:35 +00:00
@@ -492,9 +512,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/**
* Sends an array of components as a single message to the specified screen position of this player
*
+ * @deprecated This is unlikely the API you want to use. See {@link #sendActionBar(String)} for a more proper Action Bar API. This deprecated API may send unsafe items to the client.
* @param position the screen position
* @param components the components to send
*/
+ @Deprecated
public default void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) {
spigot().sendMessage(position, components);
}
2020-06-25 02:33:35 +00:00
@@ -1570,9 +1592,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/**
* Sends the component to the specified screen position of this player
*
+ * @deprecated This is unlikely the API you want to use. See {@link #sendActionBar(String)} for a more proper Action Bar API. This deprecated API may send unsafe items to the client.
* @param position the screen position
* @param component the components to send
*/
+ @Deprecated
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @NotNull net.md_5.bungee.api.chat.BaseComponent component) {
throw new UnsupportedOperationException("Not supported yet.");
}
2020-06-25 02:33:35 +00:00
@@ -1580,9 +1604,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/**
* Sends an array of components as a single message to the specified screen position of this player
*
+ * @deprecated This is unlikely the API you want to use. See {@link #sendActionBar(String)} for a more proper Action Bar API. This deprecated API may send unsafe items to the client.
* @param position the screen position
2017-05-15 16:25:20 +00:00
* @param components the components to send
*/
+ @Deprecated
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
throw new UnsupportedOperationException("Not supported yet.");
}