Starsector API
Loading...
Searching...
No Matches
com.fs.starfarer.api.impl.SharedSettings Class Reference
Collaboration diagram for com.fs.starfarer.api.impl.SharedSettings:
[legend]

Static Public Member Functions

static void loadIfNeeded ()
 
static void saveIfNeeded ()
 
static JSONObject get ()
 
static boolean optBoolean (String key, boolean defaultValue)
 
static void setBoolean (String key, boolean value)
 
static float optFloat (String key, float defaultValue)
 
static void setFloat (String key, float value)
 
static int optInt (String key, int defaultValue)
 
static void setInt (String key, int value)
 
static String optString (String key, String defaultValue)
 
static void setString (String key, String value)
 
static void unset (String key)
 

Static Public Attributes

static String SETTINGS_DATA_FILE = "core_shared_settings.json"
 

Static Protected Attributes

static JSONObject json = new JSONObject()
 

Detailed Description

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

Definition at line 24 of file SharedSettings.java.

Member Function Documentation

◆ get()

static JSONObject com.fs.starfarer.api.impl.SharedSettings.get ( )
static

Definition at line 64 of file SharedSettings.java.

◆ loadIfNeeded()

static void com.fs.starfarer.api.impl.SharedSettings.loadIfNeeded ( )
static

Definition at line 42 of file SharedSettings.java.

◆ optBoolean()

static boolean com.fs.starfarer.api.impl.SharedSettings.optBoolean ( String key,
boolean defaultValue )
static

Definition at line 69 of file SharedSettings.java.

◆ optFloat()

static float com.fs.starfarer.api.impl.SharedSettings.optFloat ( String key,
float defaultValue )
static

Definition at line 80 of file SharedSettings.java.

◆ optInt()

static int com.fs.starfarer.api.impl.SharedSettings.optInt ( String key,
int defaultValue )
static

Definition at line 91 of file SharedSettings.java.

◆ optString()

static String com.fs.starfarer.api.impl.SharedSettings.optString ( String key,
String defaultValue )
static

Definition at line 102 of file SharedSettings.java.

◆ saveIfNeeded()

static void com.fs.starfarer.api.impl.SharedSettings.saveIfNeeded ( )
static

Definition at line 54 of file SharedSettings.java.

◆ setBoolean()

static void com.fs.starfarer.api.impl.SharedSettings.setBoolean ( String key,
boolean value )
static

Definition at line 72 of file SharedSettings.java.

◆ setFloat()

static void com.fs.starfarer.api.impl.SharedSettings.setFloat ( String key,
float value )
static

Definition at line 83 of file SharedSettings.java.

◆ setInt()

static void com.fs.starfarer.api.impl.SharedSettings.setInt ( String key,
int value )
static

Definition at line 94 of file SharedSettings.java.

◆ setString()

static void com.fs.starfarer.api.impl.SharedSettings.setString ( String key,
String value )
static

Definition at line 105 of file SharedSettings.java.

◆ unset()

static void com.fs.starfarer.api.impl.SharedSettings.unset ( String key)
static

Definition at line 113 of file SharedSettings.java.

Member Data Documentation

◆ json

JSONObject com.fs.starfarer.api.impl.SharedSettings.json = new JSONObject()
staticprotected

Definition at line 27 of file SharedSettings.java.

◆ SETTINGS_DATA_FILE

String com.fs.starfarer.api.impl.SharedSettings.SETTINGS_DATA_FILE = "core_shared_settings.json"
static

Definition at line 25 of file SharedSettings.java.


The documentation for this class was generated from the following file: