Interface ServerProperty<T>
- Type Parameters:
T- the value type
- All Superinterfaces:
Supplier<T>
A named server setting, initialized from the system property it is named after.
A property starts at its default value, or at the parsed value of the system property named
name() when one is set. get() returns the current value.
A property is immutable unless <name>.mutable says otherwise, defaulting to the
minestom.properties.mutable system property. An immutable property fixes its value when it
is built, which lets the compiler fold reads away to a constant, and throws
IllegalStateException from set(Object). Configure one through its system property
instead, or make that one property writable and leave the rest foldable.
A written value is visible to other threads, but a write racing a read may or may not be seen.
-
Method Summary
Modifier and TypeMethodDescriptionGets the value this property falls back to when its system property is unset.get()Gets the current value.name()Gets the system property this property reads at startup, which also names it in error messages.voidReplaces the current value.booleanwritable()Reports whetherset(Object)would currently be accepted.
-
Method Details
-
name
String name()Gets the system property this property reads at startup, which also names it in error messages.- Returns:
- the system property name
-
defaultValue
T defaultValue()Gets the value this property falls back to when its system property is unset.- Returns:
- the default value
-
get
-
set
Replaces the current value.- Parameters:
value- the new value- Throws:
IllegalStateException- if the property is immutableIllegalArgumentException- if the value is outside the accepted range
-
writable
boolean writable()Reports whetherset(Object)would currently be accepted.- Returns:
- true if the property still accepts writes
-