Class SharedSettings

java.lang.Object
com.fs.starfarer.api.impl.SharedSettings

public class SharedSettings extends Object
Generally meant for UI settings that are shared across multiple campaigns. "Was this checkbox checked last time this dialog was closed", etc. In some cases that should be tracked per-campaign, but in some cases it makes sense for this to be shared. The amount of data stored here should be small and bounded (i.e. not growing indefinitely). Code using this should assume the data stored here may be lost (e.g. due to the common folder being deleted) and handle this/recover gracefully.
Author:
Alex
  • Field Details

    • SETTINGS_DATA_FILE

      public static String SETTINGS_DATA_FILE
    • json

      protected static org.json.JSONObject json
  • Constructor Details

    • SharedSettings

      public SharedSettings()
  • Method Details

    • loadIfNeeded

      public static void loadIfNeeded()
    • saveIfNeeded

      public static void saveIfNeeded()
    • get

      public static org.json.JSONObject get()
    • optBoolean

      public static boolean optBoolean(String key, boolean defaultValue)
    • setBoolean

      public static void setBoolean(String key, boolean value)
    • optFloat

      public static float optFloat(String key, float defaultValue)
    • setFloat

      public static void setFloat(String key, float value)
    • optInt

      public static int optInt(String key, int defaultValue)
    • setInt

      public static void setInt(String key, int value)
    • optString

      public static String optString(String key, String defaultValue)
    • setString

      public static void setString(String key, String value)
    • unset

      public static void unset(String key)