Interface ScenarioSettings


public interface ScenarioSettings
A scenario's settings as they apply to one match, already resolved.

Resolution runs in a fixed order and stops at the first source that supplies a value:

  1. the temporary lobby override, set for this one match;
  2. the source arena's override;
  3. the global configuration in scenarios.yml;
  4. the scenario's own default from its ScenarioSetting declaration.

The view is a snapshot taken when the match locked its scenarios in, so a reload or a GUI edit during a running match never changes the rules underneath the players.

Every accessor falls back to the declared default when a stored value is missing or unusable, so a broken configuration degrades to the scenario's defaults instead of failing the match.

Since:
1.6.0
  • Method Details

    • scenarioId

      @NotNull @NotNull String scenarioId()
      The scenario these settings belong to.
    • has

      boolean has(@NotNull @NotNull String key)
      Whether the setting key was declared by the scenario.
    • raw

      @NotNull @NotNull Optional<Object> raw(@NotNull @NotNull String key)
      The raw resolved value, empty when the key was never declared.
    • source

      @NotNull @NotNull ScenarioSettingSource source(@NotNull @NotNull String key)
      Where the resolved value came from.
    • getBoolean

      boolean getBoolean(@NotNull @NotNull String key)
    • getInt

      int getInt(@NotNull @NotNull String key)
    • getDouble

      double getDouble(@NotNull @NotNull String key)
    • getString

      @NotNull @NotNull String getString(@NotNull @NotNull String key)
    • getStringList

      @NotNull @NotNull List<String> getStringList(@NotNull @NotNull String key)
    • getMaterials

      @NotNull @NotNull List<org.bukkit.Material> getMaterials(@NotNull @NotNull String key)
      The setting read as a material list, skipping names that no longer resolve on this server version.
    • getMaterial

      @NotNull @NotNull Optional<org.bukkit.Material> getMaterial(@NotNull @NotNull String key)
      The setting read as a single material, empty when the name does not resolve.
    • getEntries

      @NotNull @NotNull List<ScenarioEntry> getEntries(@NotNull @NotNull String key)
      The setting read as a list of structured entries.

      Every entry is shaped by the ScenarioEntrySchema the setting declared, and entries that no longer fit that schema are left out rather than handed over half-formed. A key that is not a ScenarioSettingType.STRUCTURED_LIST yields an empty list.

      Since:
      1.6.0
    • asMap

      @NotNull @NotNull Map<String,Object> asMap()
      Every resolved value, keyed by setting key.