1
1
package xyz.xenondevs.nova.resources.builder.layout.item
2
2
3
- import com.ibm.icu.text.SimpleDateFormat
4
- import com.ibm.icu.util.TimeZone
5
- import com.ibm.icu.util.ULocale
6
3
import net.kyori.adventure.key.Key
7
4
import org.bukkit.entity.EntityType
8
5
import xyz.xenondevs.nova.registry.RegistryElementBuilderDsl
@@ -150,14 +147,23 @@ sealed class SelectItemModelProperty<T>(internal val property: SelectItemModel.P
150
147
/* *
151
148
* Returns the current time in [timeZone] formatted according to the given [pattern]
152
149
*
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 `:`.
156
162
*/
157
163
class LocalTime (
158
164
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 = " "
161
167
) : SelectItemModelProperty<String>(SelectItemModel .Property .LOCAL_TIME ) {
162
168
163
169
override fun toString (value : String ) = value
@@ -167,8 +173,8 @@ sealed class SelectItemModelProperty<T>(internal val property: SelectItemModel.P
167
173
property,
168
174
cases,
169
175
fallback,
170
- locale = locale?.name ? : " " ,
171
- timeZone = timeZone.id ,
176
+ locale = locale,
177
+ timeZone = timeZone,
172
178
pattern = pattern
173
179
)
174
180
0 commit comments