Class UpgradeSchema.Builder

java.lang.Object
de.Keyle.MyPet.api.skill.UpgradeSchema.Builder
Enclosing class:
UpgradeSchema

public static final class UpgradeSchema.Builder extends Object
Collects the fields a skill's upgrade JSON declares.
  • Method Details

    • number

      public UpgradeSchema.Builder number(String name)
      Declares a decimal field.
      Parameters:
      name - the field's name in the upgrade JSON
      Returns:
      this builder, for chaining
    • integer

      public UpgradeSchema.Builder integer(String name)
      Declares a whole-number field.
      Parameters:
      name - the field's name in the upgrade JSON
      Returns:
      this builder, for chaining
    • string

      public UpgradeSchema.Builder string(String name)
      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

      public UpgradeSchema.Builder bool(String name)
      Declares a true/false field.
      Parameters:
      name - the field's name in the upgrade JSON
      Returns:
      this builder, for chaining
    • enumOf

      public UpgradeSchema.Builder enumOf(String name, Class<? extends Enum<?>> enumClass)
      Declares a field limited to an enum's constants.
      Parameters:
      name - the field's name in the upgrade JSON
      enumClass - the enum whose constants are permitted
      Returns:
      this builder, for chaining
    • enumValues

      public UpgradeSchema.Builder enumValues(String name, List<String> values)
      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 JSON
      values - the permitted values
      Returns:
      this builder, for chaining
    • group

      Declares a nested block of fields.
      Parameters:
      name - the field's name in the upgrade JSON
      children - 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 the row fields. Unlike group(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 +n modifiers).
      Parameters:
      name - the field's name in the upgrade JSON
      row - declares the fields making up one row
      Returns:
      this builder, for chaining
    • label

      public UpgradeSchema.Builder label(String literal)
      Sets the editor label for the field declared last.
      Parameters:
      literal - the label to show
      Returns:
      this builder, for chaining
    • suffix

      public UpgradeSchema.Builder suffix(String 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

      public UpgradeSchema.Builder cumulative()
      Marks the field declared last as accumulating across levels.
      Returns:
      this builder, for chaining
    • build

      public UpgradeSchema build()
      Builds the schema.
      Returns:
      a schema holding the declared fields