Package org.lazywizard.lazylib
Class JSONUtils.CommonDataJSONObject
Object
JSONObject
CommonDataJSONObject
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
- JSONUtils
Provides a wrapper around
JSONObject that allows saving and restoring its values to/from the common data
folder (saves/common). Use this to have global settings that persist between saves.- Since:
- 2.4
-
Field Summary
Fields inherited from class JSONObject
NULL -
Constructor Summary
ConstructorsConstructorDescriptionCommonDataJSONObject(String filename) Creates a newJSONObjectthat will save to the provided filename in the common data folder. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Implemented as part of theAutoCloseableinterface.voidsave()Saves thisJSONObject's contents to common data.Methods inherited from class JSONObject
accumulate, append, doubleToString, get, getBoolean, getDouble, getInt, getJSONArray, getJSONObject, getLong, getNames, getNames, getString, has, increment, isNull, keys, length, names, numberToString, opt, optBoolean, optBoolean, optDouble, optDouble, optInt, optInt, optJSONArray, optJSONObject, optLong, optLong, optString, optString, put, put, put, put, put, put, put, putOnce, putOpt, quote, remove, sortedKeys, stringToValue, toJSONArray, toString, toString, write
-
Constructor Details
-
CommonDataJSONObject
Creates a newJSONObjectthat will save to the provided filename in the common data folder.- Parameters:
filename- The filename to save to under the common data folder.- Since:
- 2.4
-
-
Method Details
-
save
Saves thisJSONObject's contents to common data. You MUST call this if you want your data to persist!- Throws:
JSONExceptionIOException- Since:
- 2.4
-
close
Implemented as part of theAutoCloseableinterface. You will never need to call this.- Specified by:
closein interfaceAutoCloseable- Throws:
Exception- Since:
- 2.4
-