Class IntSetting

java.lang.Object
dev.myriadclient.api.setting.Setting<Integer>
dev.myriadclient.api.setting.IntSetting

public class IntSetting extends Setting<Integer>
A whole number, set with a slider or typed into a box (IntSetting.Builder.typed()). Values are clamped to min()..max(); the slider covers sliderMin()..sliderMax(), which may be narrower.
  • Constructor Details

  • Method Details

    • min

      public int min()
      The lowest value it takes; anything lower is raised to it.
    • max

      public int max()
      The highest value it takes; anything higher is lowered to it.
    • sliderMin

      public int sliderMin()
      The slider's left end.
    • sliderMax

      public int sliderMax()
      The slider's right end.
    • typed

      public boolean typed()
      Whether it's typed into a box rather than set with a slider (see IntSetting.Builder.typed()).
    • validate

      protected Integer validate(@Nullable Integer v)
      Description copied from class: Setting
      Clamps or normalises a candidate value before it's set or laid over; null gives the default.
      Overrides:
      validate in class Setting<Integer>
    • toJson

      public com.google.gson.JsonElement toJson()
      Description copied from class: Setting
      The player's value as JSON, for config and shares.
      Specified by:
      toJson in class Setting<Integer>
    • fromJson

      public void fromJson(com.google.gson.JsonElement json)
      Description copied from class: Setting
      Load from JSON; invalid input must leave the value unchanged rather than throw.
      Specified by:
      fromJson in class Setting<Integer>
    • parse

      public boolean parse(String input)
      Description copied from class: Setting
      Sets the player's value from what a player typed (a command, a text box). Returns false, leaving the value as it was, if the input isn't valid.
      Specified by:
      parse in class Setting<Integer>