Package de.Keyle.MyPet.api.skill
Class UpgradeSchema.Builder
java.lang.Object
de.Keyle.MyPet.api.skill.UpgradeSchema.Builder
- Enclosing class:
UpgradeSchema
Collects the fields a skill's upgrade JSON declares.
-
Method Summary
Modifier and TypeMethodDescriptionDeclares a true/false field.build()Builds the schema.Marks the field declared last as accumulating across levels.Declares a field limited to an enum's constants.enumValues(String name, List<String> values) Declares a field limited to an explicit set of names.group(String name, Consumer<UpgradeSchema.Builder> children) Declares a nested block of fields.Declares a whole-number field.Sets the editor label for the field declared last.list(String name, Consumer<UpgradeSchema.Builder> row) Declares a repeating row of fields.Declares a decimal field.Declares a free-text field.Sets the unit shown after the value of the field declared last.
-
Method Details
-
number
Declares a decimal field.- Parameters:
name- the field's name in the upgrade JSON- Returns:
- this builder, for chaining
-
integer
Declares a whole-number field.- Parameters:
name- the field's name in the upgrade JSON- Returns:
- this builder, for chaining
-
string
Declares a free-text field. A free-text field; the editor renders a text input. Used for pasted item strings.- Parameters:
name- the field's name in the upgrade JSON- Returns:
- this builder, for chaining
-
bool
Declares a true/false field.- Parameters:
name- the field's name in the upgrade JSON- Returns:
- this builder, for chaining
-
enumOf
Declares a field limited to an enum's constants.- Parameters:
name- the field's name in the upgrade JSONenumClass- the enum whose constants are permitted- Returns:
- this builder, for chaining
-
enumValues
Declares a field limited to an explicit set of names. An enum field whose allowed values come from a runtime list (e.g. a server registry dump).- Parameters:
name- the field's name in the upgrade JSONvalues- the permitted values- Returns:
- this builder, for chaining
-
group
Declares a nested block of fields.- Parameters:
name- the field's name in the upgrade JSONchildren- declares the fields inside the block- Returns:
- this builder, for chaining
-
list
Declares a repeating row of fields. A repeatable list field: the editor renders zero or more rows, each row carrying therowfields. Unlikegroup(java.lang.String, java.util.function.Consumer<de.Keyle.MyPet.api.skill.UpgradeSchema.Builder>), the value is an array of row objects, and the row's numeric fields are absolute values (not additive+nmodifiers).- Parameters:
name- the field's name in the upgrade JSONrow- declares the fields making up one row- Returns:
- this builder, for chaining
-
label
Sets the editor label for the field declared last.- Parameters:
literal- the label to show- Returns:
- this builder, for chaining
-
suffix
Sets the unit shown after the value of the field declared last.- Parameters:
suffix- the suffix to show- Returns:
- this builder, for chaining
-
cumulative
Marks the field declared last as accumulating across levels.- Returns:
- this builder, for chaining
-
build
Builds the schema.- Returns:
- a schema holding the declared fields
-