Package com.aliucord.api
Class SettingsAPI
-
- All Implemented Interfaces:
public class SettingsAPI
-
-
Constructor Summary
Constructors Constructor Description SettingsAPI(String plugin)
Creates a SettingsAPI for the specified plugin
-
Method Summary
Modifier and Type Method Description boolean
resetSettings()
Resets All Settings boolean
remove(String key)
Removes Item from settings List<String>
getAllKeys()
Gets All Keys from settings boolean
toggleBool(String key, boolean defValue)
Toggles Boolean and returns it boolean
exists(String key)
Check if Key exists in settings boolean
getBool(String key, boolean defValue)
Reads a from the settings. void
setBool(String key, boolean val)
Writes a to the settings. int
getInt(String key, int defValue)
Gets an stored in the settings. void
setInt(String key, int val)
Writes an to the settings. float
getFloat(String key, float defValue)
Gets a stored in the settings. void
setFloat(String key, float val)
Writes a to the settings. long
getLong(String key, long defValue)
Gets a stored in the settings. void
setLong(String key, long val)
Writes a to the settings. String
getString(String key, String defValue)
Gets a String stored in the settings. void
setString(String key, String val)
Writes a String to the settings. <T> T
getObject(String key, T defValue)
Gets an Object stored in the settings. <T> T
getObject(String key, T defValue, Type type)
Gets an Object stored in the settings. void
setObject(String key, Object val)
Writes an Object to the settings. Object
getUnknown(String key, Object defValue)
Get a value of an unknown type void
setUnknown(String key, Object value)
Set a value of an unknown type -
-
Constructor Detail
-
SettingsAPI
SettingsAPI(String plugin)
Creates a SettingsAPI for the specified plugin
-
-
Method Detail
-
resetSettings
boolean resetSettings()
Resets All Settings
-
getAllKeys
List<String> getAllKeys()
Gets All Keys from settings
-
toggleBool
boolean toggleBool(String key, boolean defValue)
Toggles Boolean and returns it
- Parameters:
key
- Key of the valuedefValue
- Default Value if setting doesn't exist
-
exists
boolean exists(String key)
Check if Key exists in settings
- Parameters:
key
- Key of the value
-
getBool
boolean getBool(String key, boolean defValue)
Reads a from the settings.
- Parameters:
key
- Key of the setting.defValue
- Default value of the setting.
-
setBool
void setBool(String key, boolean val)
Writes a to the settings.
- Parameters:
key
- Key of the setting.val
- Value of the setting.
-
getInt
int getInt(String key, int defValue)
Gets an stored in the settings.
- Parameters:
key
- Key of the setting.defValue
- Default value of the setting.
-
setInt
void setInt(String key, int val)
Writes an to the settings.
- Parameters:
key
- Key of the setting.val
- Value of the setting.
-
getFloat
float getFloat(String key, float defValue)
Gets a stored in the settings.
- Parameters:
key
- Key of the setting.defValue
- Default value of the setting.
-
setFloat
void setFloat(String key, float val)
Writes a to the settings.
- Parameters:
key
- Key of the setting.val
- Value of the setting.
-
getLong
long getLong(String key, long defValue)
Gets a stored in the settings.
- Parameters:
key
- Key of the setting.defValue
- Default value of the setting.
-
setLong
void setLong(String key, long val)
Writes a to the settings.
- Parameters:
key
- Key of the setting.val
- Value of the setting.
-
getString
String getString(String key, String defValue)
Gets a String stored in the settings.
- Parameters:
key
- Key of the setting.defValue
- Default value of the setting.
-
setString
void setString(String key, String val)
Writes a String to the settings.
- Parameters:
key
- Key of the setting.val
- Value of the setting.
-
getObject
<T> T getObject(String key, T defValue)
Gets an Object stored in the settings.
- Parameters:
key
- Key of the setting.defValue
- Default value of the setting.
-
getObject
<T> T getObject(String key, T defValue, Type type)
Gets an Object stored in the settings.
- Parameters:
key
- Key of the setting.defValue
- Default value of the setting.type
- Object representing the data type.
-
setObject
void setObject(String key, Object val)
Writes an Object to the settings.
- Parameters:
key
- Key of the setting.val
- Value of the setting.
-
getUnknown
Object getUnknown(String key, Object defValue)
Get a value of an unknown type
- Parameters:
key
- Key of the item
-
setUnknown
void setUnknown(String key, Object value)
Set a value of an unknown type
- Parameters:
key
- Key of the itemvalue
- Value of the item
-
-
-
-