public class BukkitConfig extends Config implements IBukkitSection
ConfigurationSection if you like.Config.renew() is called.getNewConfig(Plugin, String)| Constructor and Description |
|---|
BukkitConfig(org.bukkit.plugin.Plugin plugin,
File file) |
BukkitConfig(org.bukkit.plugin.Plugin plugin,
String filename) |
| Modifier and Type | Method and Description |
|---|---|
void |
addDefault(String path,
Object value)
Deprecated.
|
protected String |
convert(Object value)
Convenience method for overriding classes :)
|
org.bukkit.configuration.ConfigurationSection |
createSection(String path)
Deprecated.
|
org.bukkit.configuration.ConfigurationSection |
createSection(String path,
Map<?,?> map)
Deprecated.
|
Object |
get(String path,
Object def) |
org.bukkit.Color |
getColor(String path) |
org.bukkit.Color |
getColor(String path,
org.bukkit.Color def) |
String |
getColoredString(String path) |
String |
getColoredString(String path,
String def) |
List<String> |
getColoredStringList(String path) |
List<org.bukkit.Color> |
getColorList(String path) |
IBukkitSection |
getConfigurationSection(String path) |
String |
getCurrentPath() |
org.bukkit.configuration.ConfigurationSection |
getDefaultSection()
Deprecated.
|
org.bukkit.inventory.ItemStack |
getItemStack(String path)
Gets the requested ItemStack by path.
If the ItemStack does not exist or the value at this path is not an ItemStack, this will return null. WARNING: Only saves the ID, Damage and Amount. |
org.bukkit.inventory.ItemStack |
getItemStack(String path,
org.bukkit.inventory.ItemStack def)
Gets the requested ItemStack by path.
If the ItemStack does not exist or the value at this path is not an ItemStack, this will return def. WARNING: Only saves the ID, Damage and Amount. |
List<?> |
getList(String path) |
List<?> |
getList(String path,
List<?> def) |
org.bukkit.Location |
getLocation(String path) |
org.bukkit.Location |
getLocation(String path,
org.bukkit.Location def) |
org.bukkit.Location |
getLocation(String path,
org.bukkit.World world) |
org.bukkit.Location |
getLocation(String path,
org.bukkit.World world,
org.bukkit.Location def) |
List<org.bukkit.Location> |
getLocationList(String path)
Gets the List of Locations at the given path
Will convert all applicable values into Locations (world|x|y|z or world|x|y|z|yaw|pitch format). If no values are applicable, this will return an empty list. |
List<org.bukkit.Location> |
getLocationList(String path,
org.bukkit.World world)
Gets the List of Locations at the given path
Will convert all applicable values into Locations (x|y|z or x|y|z|yaw|pitch format). If no values are applicable, this will return an empty list. |
List<Map<?,?>> |
getMapList(String path)
Deprecated.
|
static BukkitConfig |
getNewConfig(org.bukkit.plugin.Plugin plugin,
String name)
Creates a new config and loads it.
If the file doesn't exist, will save the default config. Example usage:
public static Config config;You can then get values by doing:
String str = config.getString("path.to.str");You can set values like so:
config.set("Section1.tutorial", "This is a tutorial!"); |
protected BukkitListLine |
getNewListLine(String path,
boolean shorttype)
Can by overridden by classes that override this class to implement a different type of ListLine.
Now you don't have to rewrite Config.parse() :) |
protected BukkitValueLine |
getNewValueLine(String path,
String value)
Can by overridden by classes that override this class to implement a different type of ValueLine.
Now you don't have to rewrite Config.parse() :) |
org.bukkit.OfflinePlayer |
getOfflinePlayer(String path) |
org.bukkit.OfflinePlayer |
getOfflinePlayer(String path,
org.bukkit.OfflinePlayer def) |
BukkitConfig |
getParent() |
org.bukkit.configuration.Configuration |
getRoot() |
IBukkitSection |
getSection(String path)
Gets the requested
Section by path.Returns an empty section if it didn't exist. |
IBukkitSection |
getSectionSnapshot(String path)
Deprecated.
Not all functions work as you would expect them to. Please use
getSection(String) instead. |
Map<String,Object> |
getValues(boolean deep)
Deprecated.
|
org.bukkit.util.Vector |
getVector(String path)
Deprecated.
|
org.bukkit.util.Vector |
getVector(String path,
org.bukkit.util.Vector def)
Deprecated.
|
boolean |
isColor(String path) |
boolean |
isConfigurationSection(String path)
Deprecated.
|
boolean |
isItemStack(String path) |
boolean |
isList(String path) |
boolean |
isLocation(String path) |
boolean |
isLocationNoWorld(String path) |
boolean |
isOfflinePlayer(String path) |
boolean |
isSet(String path) |
boolean |
isVector(String path)
Deprecated.
|
void |
set(String path,
Object value)
Sets the value of the item at the given path to the given value.
If value is null, the entry is removed. This is a shortcut for set(path, true, value) |
addCommentsAbove, addCommentsBelow, addEntry, changeTo, clear, contains, get, getConfigFile, getEntries, getEntries, getKeys, getKeys, getKeys, getLogger, getName, getNewConfig, getPath, insertCorrectly, load, load, reloadConfig, remove, removeComment, removeEntry, renew, saveConfig, saveDefaultConfig, set, setListgetBoolean, getBoolean, getBooleanList, getByte, getByte, getByteList, getChar, getChar, getCharacterList, getDouble, getDouble, getDoubleList, getFloat, getFloat, getFloatList, getInt, getInt, getIntegerList, getLong, getLong, getLongList, getMixedList, getObject, getObject, getShort, getShort, getShortList, getString, getString, getStringList, getT, getT, getTList, isBoolean, isByte, isChar, isDouble, isFloat, isInt, isLong, isShort, isString, isT, remove, removeBatch, removeBatch, setList, setList, setListclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddCommentsAbove, addCommentsBelow, addEntry, contains, get, getEntries, getEntries, getKeys, getKeys, getName, getPath, remove, remove, removeBatch, removeBatch, removeEntry, renew, saveConfig, set, setList, setList, setList, setListgetBoolean, getBoolean, getBooleanList, getByte, getByte, getByteList, getChar, getChar, getCharacterList, getDouble, getDouble, getDoubleList, getFloat, getFloat, getFloatList, getInt, getInt, getIntegerList, getLong, getLong, getLongList, getMixedList, getObject, getObject, getShort, getShort, getShortList, getString, getString, getStringList, getT, getT, getTList, isBoolean, isByte, isChar, isDouble, isFloat, isInt, isLong, isShort, isString, isTcontains, get, getBoolean, getBoolean, getBooleanList, getByteList, getCharacterList, getDouble, getDouble, getDoubleList, getFloatList, getInt, getInt, getIntegerList, getKeys, getLong, getLong, getLongList, getName, getShortList, getString, getString, getStringList, isBoolean, isDouble, isInt, isLong, isStringpublic BukkitConfig(org.bukkit.plugin.Plugin plugin,
String filename)
public BukkitConfig(org.bukkit.plugin.Plugin plugin,
File file)
public static BukkitConfig getNewConfig(org.bukkit.plugin.Plugin plugin, String name)
public static Config config;
public void onLoad(){
config = Config.getNewConfig(this, "config.yml");
}
String str = config.getString("path.to.str");
int i = config.getInt("path.to.i");
Location loc = config.getLocation("path.to.location");
List<Boolean> booleans = config.getBooleanList("path.to.list");
IConfigSection section1 = config.getSection("Section1");
//Gets Section1.hey, if it doesn't exist, returns 20.
int hey = section1.getInt("hey", 20);
config.set("Section1.tutorial", "This is a tutorial!");
config.set("Section1.tutorial", null); //removes tuturial
config.remove("Section1"); //Removes Section1 and everything in it
List<String> l = new ArrayList<>();
l.add("Entry 1");
l.add("Entry 2");
config.set("Section1.list", l);
//You can also keep comments that were in Section1.list
config.setList("Section1.list", false, l);
//Don't forget to save.
config.saveConfig();
plugin - - The plugin this config belongs to.name - - The name of this config.IllegalArgumentException - If name is null, empty or ends with a dot (.).IllegalArgumentException - If plugin is null.protected BukkitListLine getNewListLine(String path, boolean shorttype)
ConfigConfig.parse() :)getNewListLine in class Confignew ListLine(path, shorttype);protected BukkitValueLine getNewValueLine(String path, String value)
ConfigConfig.parse() :)getNewValueLine in class Confignew ValueLine(path, value);protected String convert(Object value)
Configpublic void set(String path, Object value)
set(path, true, value)set in interface org.bukkit.configuration.ConfigurationSectionpath - - The path of the entry you want to change.public IBukkitSection getSection(String path)
ISectionSection by path.getSection in interface IBukkitSectiongetSection in interface ISectiongetSection in class Configpath - - Path of the Section to get.Sectionpublic IBukkitSection getSectionSnapshot(String path)
getSection(String) instead.ConfiggetSectionSnapshot in class Configpath - - Path of the Section to get a SnapShot of.public BukkitConfig getParent()
@Deprecated public void addDefault(String path, Object value)
addDefault in interface org.bukkit.configuration.ConfigurationSection@Deprecated public org.bukkit.configuration.ConfigurationSection createSection(String path)
createSection in interface org.bukkit.configuration.ConfigurationSection@Deprecated public org.bukkit.configuration.ConfigurationSection createSection(String path, Map<?,?> map)
createSection in interface org.bukkit.configuration.ConfigurationSectionpublic Object get(String path, Object def)
get in interface org.bukkit.configuration.ConfigurationSectionpublic final org.bukkit.Color getColor(String path)
getColor in interface org.bukkit.configuration.ConfigurationSectionpublic org.bukkit.Color getColor(String path, org.bukkit.Color def)
getColor in interface org.bukkit.configuration.ConfigurationSectionpublic IBukkitSection getConfigurationSection(String path)
getConfigurationSection in interface IBukkitSectiongetConfigurationSection in interface org.bukkit.configuration.ConfigurationSectionpublic String getCurrentPath()
getCurrentPath in interface org.bukkit.configuration.ConfigurationSection@Deprecated public org.bukkit.configuration.ConfigurationSection getDefaultSection()
getDefaultSection in interface org.bukkit.configuration.ConfigurationSectionpublic org.bukkit.Location getLocation(String path)
getLocation in interface IBukkitSectionpublic org.bukkit.Location getLocation(String path, org.bukkit.Location def)
getLocation in interface IBukkitSectionpublic List<org.bukkit.Location> getLocationList(String path)
IBukkitSectiongetLocationList in interface IBukkitSectionpublic boolean isLocation(String path)
isLocation in interface IBukkitSectionpublic org.bukkit.Location getLocation(String path, org.bukkit.World world)
getLocation in interface IBukkitSectionpublic org.bukkit.Location getLocation(String path, org.bukkit.World world, org.bukkit.Location def)
getLocation in interface IBukkitSectionpublic List<org.bukkit.Location> getLocationList(String path, org.bukkit.World world)
IBukkitSectiongetLocationList in interface IBukkitSectionworld - - The world that the locations should use.public boolean isLocationNoWorld(String path)
isLocationNoWorld in interface IBukkitSectionpublic String getColoredString(String path)
getColoredString in interface IBukkitSectionpublic String getColoredString(String path, String def)
getColoredString in interface IBukkitSectionpublic List<String> getColoredStringList(String path)
getColoredStringList in interface IBukkitSectionpublic final org.bukkit.inventory.ItemStack getItemStack(String path)
getItemStack in interface org.bukkit.configuration.ConfigurationSectionpath - - Path of the ItemStack to get.public org.bukkit.inventory.ItemStack getItemStack(String path, org.bukkit.inventory.ItemStack def)
getItemStack in interface org.bukkit.configuration.ConfigurationSectionpath - - Path of the ItemStack to get.def - - The value that will be returned if this value does not exist or is not an ItemStack.public List<?> getList(String path)
getList in interface org.bukkit.configuration.ConfigurationSectionpublic List<?> getList(String path, List<?> def)
getList in interface org.bukkit.configuration.ConfigurationSection@Deprecated public List<Map<?,?>> getMapList(String path)
getMapList in interface org.bukkit.configuration.ConfigurationSectionpublic final org.bukkit.OfflinePlayer getOfflinePlayer(String path)
getOfflinePlayer in interface org.bukkit.configuration.ConfigurationSectionpublic org.bukkit.OfflinePlayer getOfflinePlayer(String path, org.bukkit.OfflinePlayer def)
getOfflinePlayer in interface org.bukkit.configuration.ConfigurationSectionpublic org.bukkit.configuration.Configuration getRoot()
getRoot in interface org.bukkit.configuration.ConfigurationSection@Deprecated public Map<String,Object> getValues(boolean deep)
getValues in interface org.bukkit.configuration.ConfigurationSection@Deprecated public org.bukkit.util.Vector getVector(String path)
getVector in interface org.bukkit.configuration.ConfigurationSection@Deprecated public org.bukkit.util.Vector getVector(String path, org.bukkit.util.Vector def)
getVector in interface org.bukkit.configuration.ConfigurationSectionpublic boolean isColor(String path)
isColor in interface org.bukkit.configuration.ConfigurationSection@Deprecated public boolean isConfigurationSection(String path)
isConfigurationSection in interface org.bukkit.configuration.ConfigurationSectionpublic boolean isItemStack(String path)
isItemStack in interface org.bukkit.configuration.ConfigurationSectionpublic boolean isList(String path)
isList in interface org.bukkit.configuration.ConfigurationSectionpublic boolean isOfflinePlayer(String path)
isOfflinePlayer in interface org.bukkit.configuration.ConfigurationSectionpublic boolean isSet(String path)
isSet in interface org.bukkit.configuration.ConfigurationSection@Deprecated public boolean isVector(String path)
isVector in interface org.bukkit.configuration.ConfigurationSectionCopyright © 2014. All rights reserved.