Skip to content

Commit 506e7f6

Browse files
Remove dependency on icu4j
1 parent 4ed1e01 commit 506e7f6

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

gradle/libs.versions.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ commons-reflection = { group = "xyz.xenondevs.commons", name = "commons-reflecti
2727
configurate-yaml = { group = "org.spongepowered", name = "configurate-yaml", version = "4.1.2" }
2828
cosmic-binary-format = { group = "xyz.xenondevs.cbf", name = "cosmic-binary-format", version.ref = "cbf" }
2929
fuzzywuzzy = { group = "me.xdrop", name = "fuzzywuzzy", version = "1.4.0" }
30-
icu4j = { group = "com.ibm.icu", name = "icu4j", version = "76.1" }
3130
invui-kotlin = { group = "xyz.xenondevs.invui", name = "invui-kotlin", version.ref = "invui" }
3231
jgrapht-core = { group = "org.jgrapht", name = "jgrapht-core", version.ref = "jgrapht" }
3332
jgrapht-io = { group = "org.jgrapht", name = "jgrapht-io", version.ref = "jgrapht" }

nova/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ dependencies {
1818
novaLoaderApi(libs.bundles.xenondevs.commons)
1919
novaLoaderApi(libs.invui.kotlin)
2020
novaLoaderApi(libs.joml.primitives)
21-
novaLoaderApi(libs.icu4j)
2221

2322
// internal dependencies
2423
compileOnly(project(":nova-api"))

nova/src/main/kotlin/xyz/xenondevs/nova/resources/builder/layout/item/SelectItemModelBuilder.kt

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package xyz.xenondevs.nova.resources.builder.layout.item
22

3-
import com.ibm.icu.text.SimpleDateFormat
4-
import com.ibm.icu.util.TimeZone
5-
import com.ibm.icu.util.ULocale
63
import net.kyori.adventure.key.Key
74
import org.bukkit.entity.EntityType
85
import xyz.xenondevs.nova.registry.RegistryElementBuilderDsl
@@ -150,14 +147,23 @@ sealed class SelectItemModelProperty<T>(internal val property: SelectItemModel.P
150147
/**
151148
* Returns the current time in [timeZone] formatted according to the given [pattern]
152149
*
153-
* @param timeZone The time zone to use for formatting the time.
154-
* @param locale The locale to use for formatting the time, or `null` for the root locale.
155-
* @param pattern The pattern to use for formatting the time, interpreted by [SimpleDateFormat].
150+
* @param timeZone The time zone to use for formatting the time. If not present, defaults to the timezone set by the client.
151+
* Examples:
152+
* - `Europe/Stockholm`
153+
* - `GMT+0:45`
154+
* @param locale The locale to use for formatting the time, or `""` for the root locale.
155+
* Examples:
156+
* - `en_US`: English language (used for things like week names), formating as in the USA.
157+
* - `cs_AU@numbers=thai;calendar=japanese`: Czech language, Australian formatting, Thai numerals and Japanese calendar
158+
* @param pattern The pattern to be used for formatting the time.
159+
* Examples:
160+
* - `yyyy-MM-dd`: 4-digit year number, then 2-digit month number, then 2-digit day of month number, all zero-padded if needed, separated by `-`.
161+
* - `HH:mm:ss`: current time (hours, minutes, seconds), 24-hour cycle, all zero-padded to 2 digits of needed, separated by `:`.
156162
*/
157163
class LocalTime(
158164
private val pattern: String,
159-
private val timeZone: TimeZone,
160-
private val locale: ULocale? = null
165+
private val timeZone: String? = null,
166+
private val locale: String = ""
161167
) : SelectItemModelProperty<String>(SelectItemModel.Property.LOCAL_TIME) {
162168

163169
override fun toString(value: String) = value
@@ -167,8 +173,8 @@ sealed class SelectItemModelProperty<T>(internal val property: SelectItemModel.P
167173
property,
168174
cases,
169175
fallback,
170-
locale = locale?.name ?: "",
171-
timeZone = timeZone.id,
176+
locale = locale,
177+
timeZone = timeZone,
172178
pattern = pattern
173179
)
174180

0 commit comments

Comments
 (0)