Class Config

Json configuration file reading/writing utility.

Constructors

Methods

  • Ensures that config has all the properties the data pattern contains, if not, puts default values to match the pattern.

    Parameters

    • jsonstr: string

      string representation of JSON object representing the data pattern

    Returns void

  • Ensures that config has all the properties the data pattern contains, if not, puts default values to match the pattern.

    Parameters

    • jsonobj: Scriptable

      javascript object representing the data pattern checkAndRestore

    Returns void

  • Ensures that config has all the properties the data pattern contains, if not, puts default values to match the pattern.

    Parameters

    Returns void

  • Gets property from the config.

    Type Parameters

    • T =
          | string
          | number
          | boolean
          | JSONArray
          | Config

    Parameters

    • name: string

      option name, supports multi-layer calls, separated by '.'

    Returns T

    Config instance with current config as parent if the property is object, org.json.JSONArray instance if the property is an array, raw type if the property is of that raw type, null otherwise.

    config.get("generation.ore_copper.max_height");
    
  • Parameters

    • name: string

      option name, supports multi-layer calls, separated by '.'

    Returns boolean

    Boolean config value specified in config or false if no value was specified.

  • Parameters

    • name: string

      option name, supports multi-layer calls, separated by '.'

    Returns number

    Double number of value by given name from the config, or 0.0 if no value was specified.

  • Parameters

    • name: string

      option name, supports multi-layer calls, separated by '.'

    Returns number

    Floating-point number of value by given name from the config, or 0.0 if no value was specified.

  • Parameters

    • name: string

      option name, supports multi-layer calls, separated by '.'

    Returns number

    Integer of value by given name from the config, or 0 if no value was specified.

  • Returns ArrayList<string>

    Read-only ArrayList instance containing all the names in the current config file.

  • Parameters

    • name: string

      option name, supports multi-layer calls, separated by '.'

    Returns Number

    Number object instance, containing numeric value by given name from the config, or 0 if no value was specified.

  • Returns string

    2.2.1b96

  • Parameters

    • name: string

      option name, supports multi-layer calls, separated by '.'

    Returns string

    String by given name from the config, or null if no value was specified.

  • Writes configuration JSON to the file.

    Returns void

  • Sets config value. Do not use org.json.JSONObject instances to create nested objects, consider using dot-separated names instead.

    Type Parameters

    Parameters

    Returns boolean

Copyright © 2024 Nernar. Copyright © 2020 #mineprogramming. Built with ❤ and TypeDoc.