2020-05-06 11:48:49 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2016-12-20 21:56:41 +01: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
2021-03-03 23:43:45 +01:00
index 38f47517d5391696c52d8848c21dee40033458e6..f5d9899ec0788019ba14f15dc0f290abe4b3cfa8 100644
2016-12-20 21:56:41 +01:00
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
2021-02-21 20:45:33 +01:00
@@ -3,6 +3,7 @@ package org.bukkit.entity;
import java.net.InetSocketAddress;
import java.util.UUID;
import com.destroystokyo.paper.Title; // Paper
+import net.kyori.adventure.text.Component;
import org.bukkit.DyeColor;
import org.bukkit.Effect;
import org.bukkit.GameMode;
2021-02-24 10:32:17 +01:00
@@ -616,6 +617,39 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
2019-03-20 01:28:15 +01:00
public void sendMap(@NotNull MapView map);
2016-12-20 21:56:41 +01:00
// Paper start
2016-12-27 21:20:09 +01:00
+
+ /**
+ * Sends an Action Bar message to the client.
+ *
+ * Use Section symbols for legacy color codes to send formatting.
+ *
+ * @param message The message to send
2021-02-21 20:45:33 +01:00
+ * @deprecated use {@link #sendActionBar(Component)}
2016-12-27 21:20:09 +01:00
+ */
2021-02-21 20:45:33 +01:00
+ @Deprecated
2019-03-20 01:28:15 +01:00
+ public void sendActionBar(@NotNull String message);
2016-12-27 21:20:09 +01:00
+
+ /**
+ * 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
2021-02-21 20:45:33 +01:00
+ * @deprecated use {@link #sendActionBar(Component)}
2016-12-27 21:20:09 +01:00
+ */
2021-02-21 20:45:33 +01:00
+ @Deprecated
2019-03-20 01:28:15 +01:00
+ public void sendActionBar(char alternateChar, @NotNull String message);
2020-07-22 10:01:35 +02:00
+
+ /**
+ * Sends an Action Bar message to the client.
+ *
+ * @param message The components to send
2021-02-21 20:45:33 +01:00
+ * @deprecated use {@link #sendActionBar(Component)}
2020-07-22 10:01:35 +02:00
+ */
2021-02-21 20:45:33 +01:00
+ @Deprecated
2020-07-22 10:01:35 +02:00
+ public void sendActionBar(@NotNull net.md_5.bungee.api.chat.BaseComponent... message);
2016-12-27 21:20:09 +01:00
+
2016-12-20 21:56:41 +01:00
/**
* Sends the component to the player
*
2021-02-24 10:32:17 +01:00
@@ -643,9 +677,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
2016-12-27 21:20:09 +01:00
/**
* 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);
}
2021-03-03 23:43:45 +01:00
@@ -1713,6 +1749,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
2016-12-27 21:20:09 +01:00
/**
* 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
2021-02-21 20:45:33 +01:00
* @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
2021-03-03 23:43:45 +01:00
@@ -1725,6 +1762,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
2016-12-27 21:20:09 +01:00
/**
* 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 18:25:20 +02:00
* @param components the components to send
2021-02-21 20:45:33 +01:00
* @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}