Class ScenarioEntry
java.lang.Object
dev.itsharshxd.zentrix.api.scenario.ScenarioEntry
One entry of a
ScenarioSettingType.STRUCTURED_LIST setting.
An entry is an immutable set of values keyed by the field keys of its ScenarioEntrySchema.
Every accessor falls back to the field's declared default, so reading a field a stored entry left out
yields the same value the scenario asked for rather than nothing at all.
Instances are cheap and immutable: with(String, Object) returns a new entry, which is how
the management GUI edits one field at a time without ever mutating what a running match is using.
- Since:
- 1.6.0
-
Constructor Summary
ConstructorsConstructorDescriptionScenarioEntry(@NotNull ScenarioEntrySchema schema, @NotNull Map<String, Object> values) An entry ofschemaholdingvalues. -
Method Summary
Modifier and TypeMethodDescriptionasMap()Every stored value, keyed by field key, in declaration order.boolean@Nullable ObjectThe value of one field, falling back to the field's default.booleangetBoolean(@NotNull String key) doubleint@NotNull Optional<org.bukkit.Material> getMaterial(@NotNull String key) The field read as a Bukkit material, empty when the stored name does not resolve.@NotNull StringbooleanWhether this entry stores a value of its own for the field.inthashCode()booleanWhether every required field of the schema carries a value.The stored value of one field, without falling back to its default.@NotNull ScenarioEntrySchemaschema()toString()@NotNull ScenarioEntryA copy of this entry with one field changed; a null value clears the field.
-
Constructor Details
-
ScenarioEntry
public ScenarioEntry(@NotNull @NotNull ScenarioEntrySchema schema, @NotNull @NotNull Map<String, Object> values) An entry ofschemaholdingvalues.Values whose keys the schema does not declare are dropped, so an entry can never carry a field a later version of the scenario stopped declaring.
-
-
Method Details
-
schema
-
raw
The stored value of one field, without falling back to its default. -
has
Whether this entry stores a value of its own for the field. -
get
The value of one field, falling back to the field's default. -
getString
-
getInt
-
getDouble
-
getBoolean
-
getMaterial
The field read as a Bukkit material, empty when the stored name does not resolve. -
asMap
Every stored value, keyed by field key, in declaration order. -
with
@NotNull public @NotNull ScenarioEntry with(@NotNull @NotNull String key, @Nullable @Nullable Object value) A copy of this entry with one field changed; a null value clears the field. -
isComplete
public boolean isComplete()Whether every required field of the schema carries a value. -
equals
-
hashCode
public int hashCode() -
toString
-