Package cn.nukkit.utils
Class Config
java.lang.Object
cn.nukkit.utils.Config
- Author:
- MagicDroidX (Nukkit)
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConfig()
Constructor for Config (YAML) instance with undefined file objectConfig
(int type) Constructor for Config instance with undefined file objectConfig
(File file, int type, ConfigSection defaultMap) Config
(File file, int type, LinkedHashMap<String, Object> defaultMap) Deprecated.Config
(String file, int type, ConfigSection defaultMap) Config
(String file, int type, LinkedHashMap<String, Object> defaultMap) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionboolean
check()
boolean
boolean
<T> T
getAll()
boolean
getBoolean
(String key) boolean
getBoolean
(String key, boolean defaultValue) getBooleanList
(String key) getByteList
(String key) getCharacterList
(String key) double
double
getDoubleList
(String key) getFloatList
(String key) int
int
getIntegerList
(String key) getKeys()
getKeys
(boolean child) long
long
getLongList
(String key) getMapList
(String key) Deprecated.<T> T
Deprecated.useget(String, Object)
instead<T> T
getNestedAs
(String key, Class<T> type) Deprecated.useget(String)
insteadGet root (main) config section of the ConfiggetSection
(String key) getSections
(String key) getShortList
(String key) getStringList
(String key) boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
load
(InputStream inputStream) boolean
boolean
boolean
load
(String file, int type, ConfigSection defaultMap) boolean
loadAsJson
(InputStream inputStream, com.google.gson.Gson gson) void
reload()
void
void
removeNested
(String key) Deprecated.useremove(String)
insteadboolean
save()
boolean
boolean
Save configuration into provided file.boolean
boolean
saveAsJson
(boolean async, com.google.gson.Gson gson) boolean
saveAsJson
(File file, boolean async, com.google.gson.Gson gson) void
void
setAll
(ConfigSection section) void
setAll
(LinkedHashMap<String, Object> map) int
setDefault
(ConfigSection map) int
setDefault
(LinkedHashMap<String, Object> map)
-
Field Details
-
DETECT
public static final int DETECT- See Also:
-
PROPERTIES
public static final int PROPERTIES- See Also:
-
CNF
public static final int CNF- See Also:
-
JSON
public static final int JSON- See Also:
-
YAML
public static final int YAML- See Also:
-
ENUM
public static final int ENUM- See Also:
-
ENUMERATION
public static final int ENUMERATION- See Also:
-
format
-
-
Constructor Details
-
Config
public Config(int type) Constructor for Config instance with undefined file object- Parameters:
type
- - Config type
-
Config
public Config()Constructor for Config (YAML) instance with undefined file object -
Config
-
Config
-
Config
-
Config
-
Config
Deprecated. -
Config
-
Config
-
Config
Deprecated.
-
-
Method Details
-
reload
public void reload() -
load
-
load
-
load
-
load
-
loadAsJson
@PowerNukkitOnly @Since("1.5.2.0-PN") public boolean loadAsJson(@Nullable InputStream inputStream, @NotNull com.google.gson.Gson gson) -
check
public boolean check() -
isCorrect
public boolean isCorrect() -
save
Save configuration into provided file. Internal file object will be set to new file.- Parameters:
file
-async
-- Returns:
-
save
-
saveAsJson
@PowerNukkitOnly @Since("1.5.2.0-PN") public boolean saveAsJson(@NotNull File file, boolean async, @NotNull com.google.gson.Gson gson) -
save
public boolean save() -
saveAsJson
@PowerNukkitOnly @Since("1.5.2.0-PN") public boolean saveAsJson(boolean async, @NotNull com.google.gson.Gson gson) -
save
-
set
-
get
-
get
-
getSection
-
isSection
-
getSections
-
getSections
-
getInt
-
getInt
-
isInt
-
getLong
-
getLong
-
isLong
-
getDouble
-
getDouble
-
isDouble
-
getString
-
getString
-
isString
-
getBoolean
-
getBoolean
-
isBoolean
-
getList
-
getList
-
isList
-
getStringList
-
getIntegerList
-
getBooleanList
-
getDoubleList
-
getFloatList
-
getLongList
-
getByteList
-
getCharacterList
-
getShortList
-
getMapList
-
setAll
-
setAll
-
exists
-
exists
-
remove
-
getAll
-
getRootSection
Get root (main) config section of the Config- Returns:
-
setDefault
-
setDefault
-
getNested
Deprecated.useget(String)
instead -
getNested
Deprecated.useget(String, Object)
instead -
getNestedAs
Deprecated.useget(String)
instead -
removeNested
Deprecated.useremove(String)
instead -
getKeys
-
getKeys
-
get(String)
instead