Class EnumSetSetting<E extends Enum<E>>

java.lang.Object
dev.myriadclient.api.setting.Setting<Set<E>>
dev.myriadclient.api.setting.EnumSetSetting<E>

public class EnumSetSetting<E extends Enum<E>> extends Setting<Set<E>>
Any number of an enum's constants ("which of these"): sound kinds to block, what to notify about, which parts to draw. Shown as a picker; command input: add <v>, remove <v>, clear, or a comma-separated list to replace the lot.
  • Constructor Details

  • Method Details

    • type

      public Class<E> type()
      The enum the constants come from.
    • values

      public E[] values()
      Every constant of the enum, in declaration order; a new array each call.
    • contains

      public boolean contains(E e)
      Whether e is in the set in effect.
    • toggle

      public void toggle(E e)
      Adds e to the player's set, or removes it if it's there.
    • add

      public void add(E e)
      Adds e to the player's set.
    • remove

      public void remove(E e)
      Removes e from the player's set.
    • copy

      protected Set<E> copy(Set<E> v)
      Description copied from class: Setting
      Copy a value so the default is never mutated. Override for mutable collection types.
      Overrides:
      copy in class Setting<Set<E extends Enum<E>>>
    • 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<Set<E extends Enum<E>>>
    • 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<Set<E extends Enum<E>>>
    • 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<Set<E extends Enum<E>>>
    • suggestions

      public List<String> suggestions()
      Description copied from class: Setting
      Completions for command input; none by default.
      Overrides:
      suggestions in class Setting<Set<E extends Enum<E>>>
    • valueString

      public String valueString()
      Description copied from class: Setting
      The value in effect for people, the way Setting.parse(String) reads it back where it can.
      Overrides:
      valueString in class Setting<Set<E extends Enum<E>>>