Package arc
Class Settings
java.lang.Object
arc.Settings
- Direct Known Subclasses:
MockSettings
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected ReusableByteInStream
protected ByteArrayOutputStream
protected Fi
protected ExecutorService
protected boolean
protected Json
protected boolean
protected static final int
protected boolean
protected boolean
protected static final byte
protected static final byte
protected static final byte
protected static final byte
protected static final byte
protected static final byte
protected UBJsonReader
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
autosave()
Saves if any modifications were done.void
clear()
Clears all preference values.void
Set up a list of defaults values.void
Saves all values and keybinds.boolean
boolean
boolean
getBoolOnce
(String name) Returns true once, and never again.void
getBoolOnce
(String name, Runnable run) Runs the specified code once, and never again.byte[]
byte[]
Returns the directory where all settings and data is placed.getDefault
(String name) float
float
int
int
<T> T
<T> T
long
Returns the file used for writing settings to.boolean
boolean
keys()
int
keySize()
void
load()
Loads all values and keybinds.void
Loads a settings file intovalues
using the specified appName.void
loadValues
(Fi file) void
Manually save, if the settings have been loaded at some point.boolean
modified()
void
Stores an object in the preference map.void
void
void
void
void
Saves all entries fromvalues
into the correct location.void
setAppName
(String name) void
setAutosave
(boolean autosave) Set whether the data should autosave immediately upon changing a value.void
setDataDirectory
(Fi file) Sets the settings file where everything is written to.void
setErrorHandler
(Cons<Throwable> handler) Sets the error handler function.void
-
Field Details
-
typeBool
protected static final byte typeBool- See Also:
-
typeInt
protected static final byte typeInt- See Also:
-
typeLong
protected static final byte typeLong- See Also:
-
typeFloat
protected static final byte typeFloat- See Also:
-
typeString
protected static final byte typeString- See Also:
-
typeBinary
protected static final byte typeBinary- See Also:
-
maxBackups
protected static final int maxBackups- See Also:
-
dataDirectory
-
appName
-
defaults
-
values
-
modified
protected boolean modified -
errorHandler
-
hasErrored
protected boolean hasErrored -
shouldAutosave
protected boolean shouldAutosave -
loaded
protected boolean loaded -
executor
-
byteStream
-
byteInputStream
-
ureader
-
json
-
-
Constructor Details
-
Settings
public Settings()
-
-
Method Details
-
setJson
-
getAppName
-
setAppName
-
setErrorHandler
Sets the error handler function. This function gets called whenforceSave()
orload()
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 intovalues
using the specified appName. -
loadValues
- Throws:
IOException
-
saveValues
public void saveValues()Saves all entries fromvalues
into the correct location. -
getSettingsFile
Returns the file used for writing settings to. Not available on all platforms! -
getBackupFolder
-
getBackupSettingsFile
-
getDataDirectory
Returns the directory where all settings and data is placed. -
setDataDirectory
Sets the settings file where everything is written to. -
defaults
Set up a list of defaults values. Format: name1, default1, name2, default2, etc -
clear
public void clear()Clears all preference values. -
getDefault
-
has
-
get
-
isModified
public boolean isModified() -
putJson
-
putJson
-
getJson
-
getJson
-
getFloat
-
getLong
-
getLong
-
getInt
-
getBool
-
getBytes
-
getString
-
getFloat
-
getInt
-
getBool
-
getBoolOnce
Runs the specified code once, and never again. -
getBoolOnce
Returns true once, and never again. -
getBytes
-
getString
-
putAll
-
put
Stores an object in the preference map. -
remove
-
keys
-
keySize
public int keySize()
-