aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0045-Add-String-based-Action-Bar-API.patch
blob: 1e5f4f4d85e702b848723e67a22b4450da78fac9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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
index fd288cc72e048c6277d78c6fb1cc9b6284f67ee9..2a4cbda6cf881b850c293e54c142c3fe7a5165bd 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -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;
@@ -735,6 +736,39 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
     public void sendMap(@NotNull 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
+     * @deprecated use {@link #sendActionBar(Component)}
+     */
+    @Deprecated
+    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
+     * @deprecated use {@link #sendActionBar(Component)}
+     */
+    @Deprecated
+    public void sendActionBar(char alternateChar, @NotNull String message);
+
+    /**
+     * Sends an Action Bar message to the client.
+     *
+     * @param message The components to send
+     * @deprecated use {@link #sendActionBar(Component)}
+     */
+    @Deprecated
+    public void sendActionBar(@NotNull net.md_5.bungee.api.chat.BaseComponent... message);
+
     /**
      * Sends the component to the player
      *
@@ -762,9 +796,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);
     }
@@ -2269,6 +2305,7 @@ 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 use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
@@ -2281,6 +2318,7 @@ 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 use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}