Class ConfigShare

java.lang.Object
dev.myriadclient.api.share.ConfigShare

public final class ConfigShare extends Object
A shared config: the modules, control panels, wheels and theme someone shared, with their settings (never protected ones), plus how each looked in their menu, so the website can show it. Immutable; made by ConfigShares.builder(), fetched by ConfigShares.fetch(String), taken in by ConfigShares.apply(ConfigShare, ConfigShares.Apply).

The document is JSON, format 1:

{ "format": 1, "title": "...", "made": {"core": "0.3.4"}, "addons": [{"id", "name", "version"}],
  "modules": [{"id", "enabled", "settings": {group: {setting: value}}, "view": {...}}],
  "controlPanels": [{"name", "description", "members": [ids], "settings": {module: {setting: value}}}],
  "wheels": [{"name", "icon", "keybind", "slots": [{"kind", "target", "label", "icon", "name"}]}],
  "theme": {"name", "settings": {...}} }
  • Field Details

    • FORMAT

      public static final int FORMAT
      The document format this core writes and reads.
      See Also:
  • Method Details

    • of

      public static ConfigShare of(com.google.gson.JsonObject json)
      Wraps a document (a copy of it); throws IllegalArgumentException if it has no format this version reads.
    • parse

      public static ConfigShare parse(String json)
      Reads a document from JSON text, as toString() writes it; throws IllegalArgumentException if it isn't a JSON object of a format this version reads (Gson's own exception for malformed JSON).
    • json

      public com.google.gson.JsonObject json()
      The document, as JSON (a copy).
    • title

      public String title()
      Its title, "Shared config" if it has none.
    • description

      public String description()
      Its description, empty if it has none.
    • modules

      public List<String> modules()
      The ids of the modules in it.
    • controlPanels

      public List<String> controlPanels()
      The names of the control panels in it.
    • hasTheme

      public boolean hasTheme()
      Whether it carries a theme.
    • addons

      public List<String> addons()
      The mod ids of the addons its modules come from.
    • isEmpty

      public boolean isEmpty()
      Whether it has nothing in it.
    • toString

      public String toString()
      The document as compact JSON text, which parse(String) reads back.
      Overrides:
      toString in class Object