Interface SettingsService
public interface SettingsService
Reading and changing the
settings.yml values of Zentrix's settings menu, with the same
validation and the same effect on the running server.
Only the settings the menu offers are available - an explicit allow-list without storage
credentials, licensing or anything else sensitive. A change is validated, written to
settings.yml, the file is reloaded and whatever depends on the setting is refreshed,
exactly as when an administrator changes it in the menu. Successful changes from either fire
SettingChangeEvent.
Every method must be called on the main thread. Changes are persistent: there is no temporary overlay, and they survive restarts.
- Since:
- 1.8.0
-
Method Summary
Modifier and TypeMethodDescription@NotNull Optional<SettingDescriptor> getSetting(@NotNull String path) The editable setting at asettings.ymlpath.@NotNull List<SettingDescriptor> Every editable setting, in the settings menu's order.The value an editable setting holds in the loadedsettings.yml.@NotNull CompletableFuture<SettingChangeResult> Validates and saves a value, then applies it to the running server.
-
Method Details
-
getSettings
Every editable setting, in the settings menu's order. -
getSetting
The editable setting at asettings.ymlpath. -
getValue
The value an editable setting holds in the loadedsettings.yml.- Returns:
- the value; empty for an unknown path or an unset value
-
set
@NotNull @NotNull CompletableFuture<SettingChangeResult> set(@NotNull @NotNull String path, @Nullable @Nullable Object value) Validates and saves a value, then applies it to the running server.Completes on the main thread. Usually at once; a Cornucopia schematic that has to be read first completes once it was. Pass null only for
SettingDescriptor.Type.NULLABLE_LOCATION.- Throws:
IllegalStateException- off the main thread
-