Package arc

Class Settings

java.lang.Object
arc.Settings
Direct Known Subclasses:
MockSettings

public class Settings extends Object
  • Field Details

  • Constructor Details

    • Settings

      public Settings()
  • Method Details

    • setJson

      public void setJson(Json json)
    • getAppName

      public String getAppName()
    • setAppName

      public void setAppName(String name)
    • setErrorHandler

      public void setErrorHandler(Cons<Throwable> handler)
      Sets the error handler function. This function gets called when forceSave() or load() fails. This can occur most often on browsers, where extensions can block writing to local storage.
    • setAutosave

      public void setAutosave(boolean autosave)
      Set whether the data should autosave immediately upon changing a value. Default value: true.
    • modified

      public boolean modified()
    • load

      public void load()
      Loads all values and keybinds.
    • forceSave

      public void forceSave()
      Saves all values and keybinds.
    • manualSave

      public void manualSave()
      Manually save, if the settings have been loaded at some point.
    • autosave

      public void autosave()
      Saves if any modifications were done.
    • loadValues

      public void loadValues()
      Loads a settings file into values using the specified appName.
    • loadValues

      public void loadValues(Fi file) throws IOException
      Throws:
      IOException
    • saveValues

      public void saveValues()
      Saves all entries from values into the correct location.
    • getSettingsFile

      public Fi getSettingsFile()
      Returns the file used for writing settings to. Not available on all platforms!
    • getBackupFolder

      public Fi getBackupFolder()
    • getBackupSettingsFile

      public Fi getBackupSettingsFile()
    • getDataDirectory

      public Fi getDataDirectory()
      Returns the directory where all settings and data is placed.
    • setDataDirectory

      public void setDataDirectory(Fi file)
      Sets the settings file where everything is written to.
    • defaults

      public void defaults(Object... objects)
      Set up a list of defaults values. Format: name1, default1, name2, default2, etc
    • clear

      public void clear()
      Clears all preference values.
    • getDefault

      public Object getDefault(String name)
    • has

      public boolean has(String name)
    • get

      public Object get(String name, Object def)
    • isModified

      public boolean isModified()
    • putJson

      public void putJson(String name, Object value)
    • putJson

      public void putJson(String name, Class<?> elementType, Object value)
    • getJson

      public <T> T getJson(String name, Class<T> type, Class elementType, Prov<T> def)
    • getJson

      public <T> T getJson(String name, Class<T> type, Prov<T> def)
    • getFloat

      public float getFloat(String name, float def)
    • getLong

      public long getLong(String name, long def)
    • getLong

      public Long getLong(String name)
    • getInt

      public int getInt(String name, int def)
    • getBool

      public boolean getBool(String name, boolean def)
    • getBytes

      public byte[] getBytes(String name, byte[] def)
    • getString

      public String getString(String name, String def)
    • getFloat

      public float getFloat(String name)
    • getInt

      public int getInt(String name)
    • getBool

      public boolean getBool(String name)
    • getBoolOnce

      public void getBoolOnce(String name, Runnable run)
      Runs the specified code once, and never again.
    • getBoolOnce

      public boolean getBoolOnce(String name)
      Returns true once, and never again.
    • getBytes

      public byte[] getBytes(String name)
    • getString

      public String getString(String name)
    • putAll

      public void putAll(ObjectMap<String,Object> map)
    • put

      public void put(String name, Object object)
      Stores an object in the preference map.
    • remove

      public void remove(String name)
    • keys

      public Iterable<String> keys()
    • keySize

      public int keySize()