Class DefaultConfigRef<T>
java.lang.Object
tech.guilhermekaua.spigotboot.config.reload.DefaultConfigRef<T>
- Type Parameters:
T- the config type
Default implementation of ConfigRef.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(@NotNull Consumer<T> listener) Adds a listener for config changes.get()Gets the current config value.Gets the config class this ref wraps.booleanisLoaded()Checks if the config has been loaded at least once.voidreload()Forces a reload of this config.voidremoveListener(@NotNull Consumer<T> listener) Removes a previously added listener.voidUpdates the value without triggering reload.
-
Constructor Details
-
Method Details
-
get
Description copied from interface:ConfigRefGets the current config value. -
addListener
Description copied from interface:ConfigRefAdds a listener for config changes.- Specified by:
addListenerin interfaceConfigRef<T>- Parameters:
listener- the listener to add
-
removeListener
Description copied from interface:ConfigRefRemoves a previously added listener.- Specified by:
removeListenerin interfaceConfigRef<T>- Parameters:
listener- the listener to remove
-
isLoaded
public boolean isLoaded()Description copied from interface:ConfigRefChecks if the config has been loaded at least once. -
reload
public void reload()Description copied from interface:ConfigRefForces a reload of this config. -
getConfigClass
Description copied from interface:ConfigRefGets the config class this ref wraps.- Specified by:
getConfigClassin interfaceConfigRef<T>- Returns:
- the config class
-
update
Updates the value without triggering reload.- Parameters:
newValue- the new value
-