Class ConfigStrings

java.lang.Object
my.celium.org.config.ConfigStrings

public final class ConfigStrings extends Object
String conversion for ConfigValues: display, parsing and lookup by path.

A path is "key" for root values or "category.key" for categorised ones. Bare-key lookup succeeds when exactly one value carries that key; otherwise the fully qualified path is required.

All parsing goes through the same validators as programmatic ConfigValue.set(Object) calls, so /mycel set can never sneak an out-of-range value past the config screen's rules.

  • Method Details

    • pathOf

      public static String pathOf(ConfigValue<?> value)
      Canonical path of a value: key or category.key.
    • find

      public static ConfigValue<?> find(MycelConfig config, String path)
      Finds a value inside config by path (see class javadoc).
      Returns:
      the value, or null when nothing matches
    • valueToString

      public static String valueToString(ConfigValue<?> value)
      Human-readable current value (lists render comma-separated).
    • defaultToString

      public static String defaultToString(ConfigValue<?> value)
      Human-readable default value.
    • constraintHint

      public static String constraintHint(ConfigValue<?> value)
      Short constraint hint: ranges, allowed enum names, max length, ...
    • describe

      public static String describe(ConfigValue<?> value)
      One-line type summary used by /mycel get <mod>.
    • parseAndSet

      public static void parseAndSet(ConfigValue<?> value, String text)
      Parses text and applies it to value, exactly as ConfigValue.set(Object) would.
      Throws:
      IllegalArgumentException - with a friendly message when invalid