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 Details

    • getSettings

      @NotNull @NotNull List<SettingDescriptor> getSettings()
      Every editable setting, in the settings menu's order.
    • getSetting

      @NotNull @NotNull Optional<SettingDescriptor> getSetting(@NotNull @NotNull String path)
      The editable setting at a settings.yml path.
    • getValue

      @NotNull @NotNull Optional<Object> getValue(@NotNull @NotNull String path)
      The value an editable setting holds in the loaded settings.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