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

78 lines
3.5 KiB
Diff
Raw Normal View History

2017-04-01 04:24:42 +00:00
From d6bb5c03434b922e1743da728186da22bc0786fe 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
2017-04-01 04:24:42 +00:00
index a0b95550..2c166a8c 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
2017-02-18 02:03:38 +00:00
@@ -393,6 +393,26 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
2016-12-20 20:56:41 +00:00
public void sendMap(MapView map);
// 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(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, String message);
+
2016-12-20 20:56:41 +00:00
/**
* Sends the component to the player
*
2017-02-18 02:03:38 +00:00
@@ -416,9 +436,11 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
/**
* 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);
}
2017-04-01 04:24:42 +00:00
@@ -1705,9 +1727,11 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
/**
* 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(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent component) {
throw new UnsupportedOperationException("Not supported yet.");
}
2017-04-01 04:24:42 +00:00
@@ -1715,9 +1739,11 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
/**
* 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 component the components to send
+ * @param components the components to send
*/
+ @Deprecated
public void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) {
throw new UnsupportedOperationException("Not supported yet.");
}
2016-12-20 20:56:41 +00:00
--
2017-04-01 04:24:42 +00:00
2.12.1.windows.1
2016-12-20 20:56:41 +00:00