Class ScenarioProfile
This is the same shape as an arena's section of scenarios.yml, expressed as a value
instead of as a file: how a match picks its scenarios, the administrator set, the automatic and
voting rules, and — per scenario — whether it is switched on, which game types it is kept out of,
and what its settings are. It is read ahead of both the stored arena overrides and the global
configuration, and it is never written to disk.
A profile is attached to an ArenaSourceLease, so the arena a match is created from
carries the rules that match will run under. Anything the profile does not mention falls through
to the ordinary configuration, which is what makes an empty profile mean
"use the server's own settings" rather than "run nothing".
Values are stored under the same keys the configuration file uses, so a profile built by the builder and one loaded from an addon's own YAML are the same thing. Every value is validated when the match reads it: a setting whose value no longer fits what the scenario declares is skipped exactly as a stored one would be, and a scenario that is not registered is ignored without its values being lost.
- Since:
- 1.6.0
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringWhere the administrator set lives.static final StringHow many scenarios an automatic match draws.static final StringWhat an automatic match may draw from; empty means every selectable scenario.static final StringThe prefix every per-scenario section sits under.static final StringWhere a match's selection mode lives.static final StringThe prefix every voting rule sits under. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ScenarioProfile.Builderbuilder()The scenario IDs this profile mentions anywhere, for diagnostics.static @NotNull ScenarioProfileempty()A profile that overrides nothing, so every match reads the server's own configuration.booleanisEmpty()Whether this profile overrides nothing at all.static @NotNull ScenarioProfileA profile built from values already keyed by configuration path.@NotNull Optional<ScenarioSelectionMode> The selection mode this profile imposes, empty when it leaves the decision alone.toString()One override, empty when this profile has no opinion about that path.values()Every override, keyed by the configuration path it applies to.
-
Field Details
-
SELECTION_MODE
Where a match's selection mode lives.- See Also:
-
ADMIN_SET
Where the administrator set lives.- See Also:
-
AUTOMATIC_COUNT
How many scenarios an automatic match draws.- See Also:
-
AUTOMATIC_POOL
What an automatic match may draw from; empty means every selectable scenario.- See Also:
-
VOTING_PREFIX
The prefix every voting rule sits under.- See Also:
-
SCENARIOS_PREFIX
The prefix every per-scenario section sits under.- See Also:
-
-
Method Details
-
empty
A profile that overrides nothing, so every match reads the server's own configuration. -
of
A profile built from values already keyed by configuration path.Useful for an addon that stores its profile in a YAML file of its own: the paths are the ones
scenarios.ymluses under an arena, so the file can be read straight into a profile. Blank paths and null values are dropped. -
builder
-
isEmpty
public boolean isEmpty()Whether this profile overrides nothing at all. -
values
Every override, keyed by the configuration path it applies to. -
value
One override, empty when this profile has no opinion about that path. -
selectionMode
The selection mode this profile imposes, empty when it leaves the decision alone. -
configuredScenarioIds
The scenario IDs this profile mentions anywhere, for diagnostics. -
toString
-