11package app.simplecloud.plugin.prefixes.api
22
3+ import net.kyori.adventure.audience.Audience
34import net.kyori.adventure.text.Component
5+ import net.kyori.adventure.text.format.TextColor
46import java.util.*
57
68interface PrefixesApi {
79
10+ /* *
11+ * Registers a player to be able to see prefixes
12+ * @param uniqueId UUID of the target player
13+ */
14+ fun registerViewer (uniqueId : UUID )
15+
16+ /* *
17+ * Returns if a viewer exists
18+ * @param uniqueId UUID of the target player
19+ */
20+ fun hasViewer (uniqueId : UUID ): Boolean
21+
22+ /* *
23+ * Removes a viewer
24+ * @param uniqueId UUID of the target player
25+ */
26+ fun removeViewer (uniqueId : UUID )
27+
828 /* *
929 * Sets the prefix and suffix of a player in both Tab and Chat
1030 * @param uniqueId UUID of the target player
1131 * @param group
32+ * @param viewers A list of all viewers of this change (if empty, everyone is affected)
1233 */
13- fun setWholeName (uniqueId : UUID , group : PrefixesGroup )
34+ fun setWholeName (uniqueId : UUID , group : PrefixesGroup , vararg viewers : UUID )
1435
1536 /* *
1637 * Sets the prefix and suffix of a player in both Tab and Chat
1738 * @param uniqueId UUID of the target player
1839 * @param groupName
40+ * @param viewers A list of all viewers of this change (if empty, everyone is affected)
41+ */
42+ fun setWholeName (uniqueId : UUID , groupName : String , vararg viewers : UUID )
43+
44+ /* *
45+ * Sets the prefix and suffix of a player in both Tab and Chat
46+ * @param uniqueId UUID of the target player
47+ * @param prefix the targets prefix
48+ * @param color the targets team color
49+ * @param suffix the targets suffix
50+ * @param priority the users Tablist priority
51+ * @param viewers A list of all viewers of this change (if empty, everyone is affected)
1952 */
20- fun setWholeName (uniqueId : UUID , groupName : String )
53+ fun setWholeName (uniqueId : UUID , prefix : Component , color : TextColor , suffix : Component , priority : Int , vararg viewers : UUID )
2154
2255 /* *
2356 * Sets the prefix of a player in both Tab and Chat
2457 * @param uniqueId UUID of the target player
2558 * @param prefix prefix to set
59+ * @param viewers A list of all viewers of this change (if empty, everyone is affected)
2660 */
27- fun setPrefix (uniqueId : UUID , prefix : Component )
61+ fun setPrefix (uniqueId : UUID , prefix : Component , vararg viewers : UUID )
2862
2963 /* *
3064 * Sets the prefix of a player in both Tab and Chat
3165 * @param uniqueId UUID of the target player
3266 * @param suffix suffix to set
67+ * @param viewers A list of all viewers of this change (if empty, everyone is affected)
3368 */
34- fun setSuffix (uniqueId : UUID , suffix : Component )
69+ fun setSuffix (uniqueId : UUID , suffix : Component , vararg viewers : UUID )
3570
3671 /* *
3772 * Returns all registered [PrefixesGroup] ordered by priority
@@ -59,14 +94,81 @@ interface PrefixesApi {
5994 /* *
6095 * Changes the Scoreboard Team color of the target player (Used in 1.12+ to make player names colorful)
6196 * @param uniqueId UUID of the target player
62- * @param color Color string (ChatColor on spigot, hex colors on other server implementations)
97+ * @param color the [TextColor] of the target players team
98+ * @param viewers A list of all viewers of this change (if empty, everyone is affected)
6399 */
64- fun setColor (uniqueId : UUID , color : String )
100+ fun setColor (uniqueId : UUID , color : TextColor , vararg viewers : UUID )
65101
66102 /* *
67103 * Sets the used PrefixesConfig
68104 * @param config Specifies the new [PrefixesConfig]
69105 */
70106 fun setConfig (config : PrefixesConfig )
71107
108+ /* *
109+ * Returns a formatted chat message of the target player that will be sent to the viewer
110+ * @param target UUID of the target player
111+ * @param viewer UUID of the viewing player (if null, only default prefix and suffix of the players group will be shown)
112+ * @param format the chat format the message should follow
113+ * @param message Message sent by the [target]
114+ */
115+ fun formatChatMessage (target : UUID , viewer : UUID ? , format : String , message : Component ): Component
116+ /* *
117+ * Sets the prefix and suffix of a player in both Tab and Chat
118+ * @param uniqueId UUID of the target player
119+ * @param group
120+ * @param viewers A list of all viewers of this change (if empty, everyone is affected)
121+ */
122+ fun setWholeName (uniqueId : UUID , group : PrefixesGroup , viewers : Audience )
123+
124+ /* *
125+ * Sets the prefix and suffix of a player in both Tab and Chat
126+ * @param uniqueId UUID of the target player
127+ * @param groupName
128+ * @param viewers An [Audience] of all viewers of this change (if empty, everyone is affected)
129+ */
130+ fun setWholeName (uniqueId : UUID , groupName : String , viewers : Audience )
131+
132+ /* *
133+ * Sets the prefix and suffix of a player in both Tab and Chat
134+ * @param uniqueId UUID of the target player
135+ * @param prefix the targets prefix
136+ * @param color the targets team color
137+ * @param suffix the targets suffix
138+ * @param viewers An [Audience] of all viewers of this change (if empty, everyone is affected)
139+ */
140+ fun setWholeName (uniqueId : UUID , prefix : Component , color : TextColor , suffix : Component , priority : Int , viewers : Audience )
141+ /* *
142+ * Sets the prefix of a player in both Tab and Chat
143+ * @param uniqueId UUID of the target player
144+ * @param prefix prefix to set
145+ * @param viewers A list of all viewers of this change (if empty, everyone is affected)
146+ */
147+ fun setPrefix (uniqueId : UUID , prefix : Component , viewers : Audience )
148+
149+ /* *
150+ * Sets the prefix of a player in both Tab and Chat
151+ * @param uniqueId UUID of the target player
152+ * @param suffix suffix to set
153+ * @param viewers An [Audience] of all viewers of this change (if empty, everyone is affected)
154+ */
155+ fun setSuffix (uniqueId : UUID , suffix : Component , viewers : Audience )
156+
157+ /* *
158+ * Changes the Scoreboard Team color of the target player (Used in 1.12+ to make player names colorful)
159+ * @param uniqueId UUID of the target player
160+ * @param color [TextColor] the color of the target players team
161+ * @param viewers An [Audience] of all viewers of this change (if empty, everyone is affected)
162+ */
163+ fun setColor (uniqueId : UUID , color : TextColor , viewers : Audience )
164+
165+ /* *
166+ * Returns a formatted chat message of the target player that will be sent to the viewer
167+ * @param target UUID of the target player
168+ * @param viewer An [Audience] of the viewing player (if empty, only default prefix and suffix of the targets group will be shown)
169+ * @param format the chat format the message should follow
170+ * @param message Message sent by the [target]
171+ */
172+ fun formatChatMessage (target : UUID , viewer : Audience , format : String , message : Component ): Component
173+
72174}
0 commit comments