Skip to content

Commit 7fff435

Browse files
authored
feat: add adventure message extensions for books, boss bars, titles, … (#39)
2 parents fde7013 + 0a50f37 commit 7fff435

File tree

16 files changed

+1545
-134
lines changed

16 files changed

+1545
-134
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ javaVersion=21
99
mcVersion=1.21.4
1010

1111
group=dev.slne.surf
12-
version=1.21.4-2.1.3-SNAPSHOT
12+
version=1.21.4-2.2.0-SNAPSHOT
1313
relocationPrefix=dev.slne.surf.surfapi.libs

surf-api-bukkit/surf-api-bukkit-plugin-test/src/main/kotlin/dev/slne/surf/surfapi/bukkit/test/command/subcommands/visualizer/SingleLocationVisualizerTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import dev.slne.surf.surfapi.bukkit.api.visualizer.surfVisualizerApi
1111
import dev.slne.surf.surfapi.bukkit.api.visualizer.visualizer.ExperimentalVisualizerApi
1212
import dev.slne.surf.surfapi.bukkit.api.visualizer.visualizer.SurfVisualizerSingleLocation
1313
import dev.slne.surf.surfapi.core.api.messages.Colors
14-
import dev.slne.surf.surfapi.core.api.messages.buildText
14+
import dev.slne.surf.surfapi.core.api.messages.adventure.buildText
1515
import dev.slne.surf.surfapi.core.api.random.RandomSelector
1616
import dev.slne.surf.surfapi.core.api.util.mutableObject2ObjectMapOf
1717
import net.kyori.adventure.text.Component

surf-api-core/surf-api-core-api/src/main/kotlin/dev/slne/surf/surfapi/core/api/messages/Colors.kt

Lines changed: 50 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,97 +6,110 @@ import net.kyori.adventure.text.format.TextColor
66
import net.kyori.adventure.text.format.TextColor.color
77

88
/**
9-
* A class that contains all the colors used in the Surf system. This class is used to provide a
10-
* uniform appearance across all Surf plugins.
11-
* [Simons dc post](https://discord.com/channels/1094422317783851108/1096084922499862658)
9+
* A class that defines all the colors used in the Surf system, ensuring a consistent visual style
10+
* across all Surf plugins.
11+
* This class provides predefined colors for various UI elements, including
12+
* informational messages, warnings, errors, and formatting components.
13+
*
14+
* For reference,
15+
* see [Simons dc post](https://discord.com/channels/1094422317783851108/1096084922499862658).
1216
*
1317
* @see [Simons dc post](https://discord.com/channels/1094422317783851108/1096084922499862658)
1418
*/
1519
@Suppress("unused")
1620
interface Colors {
1721
companion object {
1822
// -------------------- Surf Colors -------------------- //
23+
1924
/**
20-
* PRIMARY color (#3b92d1). Generally not used in our system. However, an example of its use could
21-
* be for titles, subtitles, etc.
25+
* The primary Surf color (#3b92d1).
26+
* Although rarely used in the system, it can be utilized
27+
* for elements like titles and subtitles.
2228
*/
2329
@JvmField
2430
val PRIMARY: TextColor = color(0x3b92d1)
2531

2632
/**
27-
* SECONDARY color (#5b5b5b). Also seldom used in our system. Could be used for elements like
28-
* subtitles.
33+
* The secondary Surf color (#5b5b5b), mainly used for elements such as subtitles.
2934
*/
3035
@JvmField
3136
val SECONDARY: TextColor = color(0x5b5b5b)
3237

3338
/**
34-
* INFO color (#40d1db). Used to inform the user about a specific situation. Typically, it's not a
35-
* follow-up to a user action. Exceptions include queued user actions that update after a delay
36-
* (e.g., status changes not related to Success or Danger), and for toggle messages (e.g., "You
37-
* have [deactivated/activated] the chat").
39+
* The info color (#40d1db).
40+
* Used to convey neutral information to users that is not directly
41+
* a result of their actions,
42+
* except in cases such as delayed status updates or toggle messages.
3843
*/
3944
@JvmField
4045
val INFO: TextColor = color(0x40d1db)
4146

4247
/**
43-
* SUCCESS color (#65ff64). Indicates a positive outcome of an action performed by the user. Used
44-
* only in direct response to the user.
48+
* The success color (#65ff64).
49+
* Indicates a positive outcome of a user action and is always
50+
* used in direct response to the user.
4551
*/
4652
@JvmField
4753
val SUCCESS: TextColor = color(0x65ff64)
4854

4955
/**
50-
* WARNING color (#f9c353). Used as a direct warning to the user. This could be a response to a
51-
* user action or a system notification, and serves as a precursor to Danger.
56+
* The warning color (#f9c353).
57+
* Used to caution users about potential issues, often serving
58+
* as a precursor to an error message.
5259
*/
5360
@JvmField
5461
val WARNING: TextColor = color(0xf9c353)
5562

5663
/**
57-
* ERROR (or DANGER) color (#ee3d51). Represents error messages directed at the user. These can
58-
* follow a direct action by the user, or serve as a warning about potential issues.
64+
* The error (or danger) color (#ee3d51).
65+
* Represents error messages directed at the user,
66+
* often following a direct user action or warning of a critical issue.
5967
*/
6068
@JvmField
6169
val ERROR: TextColor = color(0xee3d51)
6270

6371
/**
64-
* VARIABLE_KEY color (#3b92d1). Mainly used as a key in listings (e.g., "Key 1: Value", "Key 2:
65-
* Value", etc.).
72+
* The variable key color (#3b92d1).
73+
* Typically used for key-value pair representations,
74+
* such as in lists (for example, "Key 1: Value").
6675
*/
6776
@JvmField
6877
val VARIABLE_KEY: TextColor = INFO
6978

7079
/**
71-
* VARIABLE_VALUE color (#f9c353). Primarily used in listings and chat messages as a variable
72-
* (e.g., "Your property [PROPERTY] has been sold.").
80+
* The variable value color (#f9c353).
81+
* Commonly used to highlight values in lists and
82+
* chat messages (for example, "Your property 'PROPERTY' has been sold.").
7383
*/
7484
@JvmField
7585
val VARIABLE_VALUE: TextColor = WARNING
7686

7787
/**
78-
* SPACER color (GRAY). Used for various forms of spacers, such as "-, ..., /, etc."
88+
* The spacer color (GRAY). Used for visual separators such as "-", "...", and "/".
7989
*/
8090
@JvmField
8191
val SPACER: NamedTextColor = NamedTextColor.GRAY
8292

8393
/**
84-
* DARK_SPACER color (DARK_GRAY). Used for dark spacers, such as those needed in prefixes like
85-
* ">>", "|", etc.
94+
* The dark spacer color (DARK_GRAY).
95+
* Used for darker separators, such as those found in
96+
* prefixes like ">>" or "|".
8697
*/
8798
@JvmField
8899
val DARK_SPACER: NamedTextColor = NamedTextColor.DARK_GRAY
89100

90101
/**
91-
* PREFIX color (#3b92d1). Used for the color of every prefix to provide a uniform appearance.
102+
* The default prefix color (#3b92d1).
103+
* Applied to all prefixes for consistency across Surf plugins.
92104
*/
93105
@JvmField
94106
val PREFIX_COLOR: TextColor = PRIMARY
95107

96-
// ----------------------------------------------------- //
97108
// -------------------- Default Colors -------------------- //
109+
98110
/**
99-
* The prefix for all Surf plugins
111+
* The default prefix used across all Surf plugins, ensuring a recognizable and uniform
112+
* identifier in messages.
100113
*/
101114
@JvmField
102115
val PREFIX: Component = Component.text(">> ", DARK_SPACER)
@@ -122,61 +135,61 @@ interface Colors {
122135
val DARK_GREEN: NamedTextColor = NamedTextColor.DARK_GREEN
123136

124137
/**
125-
* Represents the named text color DARK_AQUA.
138+
* Represents the color dark aqua.
126139
*/
127140
@JvmField
128141
val DARK_AQUA: NamedTextColor = NamedTextColor.DARK_AQUA
129142

130143
/**
131-
* Represents the dark red color.
144+
* Represents the color dark red.
132145
*/
133146
@JvmField
134147
val DARK_RED: NamedTextColor = NamedTextColor.DARK_RED
135148

136149
/**
137-
* Represents the dark purple named text color.
150+
* Represents the color dark purple.
138151
*/
139152
@JvmField
140153
val DARK_PURPLE: NamedTextColor = NamedTextColor.DARK_PURPLE
141154

142155
/**
143-
* The GOLD color for naming text.
156+
* Represents the color gold.
144157
*/
145158
@JvmField
146159
val GOLD: NamedTextColor = NamedTextColor.GOLD
147160

148161
/**
149-
* Represents the named text color "GRAY".
162+
* Represents the color gray.
150163
*/
151164
@JvmField
152165
val GRAY: NamedTextColor = NamedTextColor.GRAY
153166

154167
/**
155-
* Represents the named text color "DARK_GRAY".
168+
* Represents the color dark gray.
156169
*/
157170
@JvmField
158171
val DARK_GRAY: NamedTextColor = NamedTextColor.DARK_GRAY
159172

160173
/**
161-
* Represents the named text color "BLUE".
174+
* Represents the color blue.
162175
*/
163176
@JvmField
164177
val BLUE: NamedTextColor = NamedTextColor.BLUE
165178

166179
/**
167-
* Represents the named text color "GREEN".
180+
* Represents the color green.
168181
*/
169182
@JvmField
170183
val GREEN: NamedTextColor = NamedTextColor.GREEN
171184

172185
/**
173-
* Represents the named text color "AQUA".
186+
* Represents the color aqua.
174187
*/
175188
@JvmField
176189
val AQUA: NamedTextColor = NamedTextColor.AQUA
177190

178191
/**
179-
* Represents the named text color "RED".
192+
* Represents the color red.
180193
*/
181194
@JvmField
182195
val RED: NamedTextColor = NamedTextColor.RED
@@ -193,13 +206,10 @@ interface Colors {
193206
@JvmField
194207
val YELLOW: NamedTextColor = NamedTextColor.YELLOW
195208

196-
// --------------------------------------------------------- //
197-
// -------------------- Prefix -------------------- //
198209
/**
199210
* Represents the color white.
200211
*/
201212
@JvmField
202213
val WHITE: NamedTextColor = NamedTextColor.WHITE
203-
// ------------------------------------------------ //
204214
}
205215
}

0 commit comments

Comments
 (0)