Package redempt.redlib.configmanager
Class ConfigManager
java.lang.Object
redempt.redlib.configmanager.ConfigManager
Deprecated.
Loads config values into variables annotated with
ConfigValue-
Constructor Summary
ConstructorsConstructorDescriptionConfigManager(File file) Deprecated.Initiates a ConfigManager using a specific file for the configConfigManager(Path path) Deprecated.Initiates a ConfigManager using a specific path for the configConfigManager(org.bukkit.plugin.Plugin plugin) Deprecated.Instantiates a ConfigManager with the default config name config.yml in the plugin's data folderConfigManager(org.bukkit.plugin.Plugin plugin, String name) Deprecated.Instantiates a ConfigManager with a specific config name in the plugin's config folder -
Method Summary
Modifier and TypeMethodDescription<T> ConfigManagerDeprecated.Adds a type converter, which will attempt to convert a String from config to another type that is not usually able to be stored in configstatic <T> ConfigCollection<T>collection(Class<T> clazz, Collection<T> toWrap, T... elements) Deprecated.Creates a ConfigCollection from a given type with initial elements.static <T> ConfigCollection<T>collection(Class<T> clazz, ConversionType type, Collection<T> toWrap, T... elements) Deprecated.Creates a ConfigCollection from a given type with initial elements.booleanDeprecated.org.bukkit.configuration.file.YamlConfigurationDeprecated.protected <T> redempt.redlib.configmanager.TypeConverter<T>getConverter(Class<T> clazz) Deprecated.static <T> redempt.redlib.configmanager.ConfigList<T>list(Class<T> clazz, ConversionType type, T... elements) Deprecated.Creates a ConfigList from a given type with initial elements.static <T> redempt.redlib.configmanager.ConfigList<T>Deprecated.Creates a ConfigList from a given type with initial elements.load()Deprecated.Loads all values from config into the annotated hook fieldsstatic <K,V> redempt.redlib.configmanager.ConfigMap<K, V> Deprecated.Creates a ConfigMap from a given type.static <K,V> redempt.redlib.configmanager.ConfigMap<K, V> map(Class<K> keyClass, Class<V> valueClass, ConversionType type) Deprecated.Creates a ConfigMap from a given type.static <T> redempt.redlib.configmanager.ConfigMap<String,T> Deprecated.Creates a ConfigMap from a given type.static <T> redempt.redlib.configmanager.ConfigMap<String,T> map(Class<T> clazz, ConversionType type) Deprecated.Creates a ConfigMap from a given type.Deprecated.Register all the hooks for annotated fields in the the given objects.save()Deprecated.Saves all values from the annotated hook fields to configDeprecated.Save default values - initial values in the hook fields - where they do not already exist in the configstatic <T> redempt.redlib.configmanager.ConfigSet<T>set(Class<T> clazz, ConversionType type, T... elements) Deprecated.Creates a ConfigSet from a given type with initial elements.static <T> redempt.redlib.configmanager.ConfigSet<T>Deprecated.Creates a ConfigSet from a given type with initial elements.stringList(String... strings) Deprecated.Instantiates a List of Strings inline
-
Constructor Details
-
ConfigManager
public ConfigManager(org.bukkit.plugin.Plugin plugin) Deprecated.Instantiates a ConfigManager with the default config name config.yml in the plugin's data folder- Parameters:
plugin- The plugin
-
ConfigManager
Deprecated.Instantiates a ConfigManager with a specific config name in the plugin's config folder- Parameters:
plugin- The pluginname- The name of the config file to generate
-
ConfigManager
Deprecated.Initiates a ConfigManager using a specific file for the config- Parameters:
file- The file
-
ConfigManager
Deprecated.Initiates a ConfigManager using a specific path for the config- Parameters:
path- The path
-
-
Method Details
-
stringList
Deprecated.Instantiates a List of Strings inline- Parameters:
strings- The Strings to include in the List- Returns:
- The List of Strings
-
map
Deprecated.Creates a ConfigMap from a given type. A ConfigMap extends LinkedHashMap. The class is not accessible, so store it in a HashMap variable. This method must be used to set the initial value for a variable which loads in a section from config.- Type Parameters:
T- The value type- Parameters:
clazz- The class of the value type- Returns:
- An empty map of the given type, which will be populated when
load()is called
-
map
public static <T> redempt.redlib.configmanager.ConfigMap<String,T> map(Class<T> clazz, ConversionType type) Deprecated.Creates a ConfigMap from a given type. A ConfigMap extends LinkedHashMap. The class is not accessible, so store it in a HashMap variable. This method must be used to set the initial value for a variable which loads in a section from config.- Type Parameters:
T- The value type- Parameters:
clazz- The class of the value typetype- The method which will be used to convert the stored type- Returns:
- An empty map of the given type, which will be populated when
load()is called
-
map
public static <K,V> redempt.redlib.configmanager.ConfigMap<K,V> map(Class<K> keyClass, Class<V> valueClass) Deprecated.Creates a ConfigMap from a given type. A ConfigMap extends LinkedHashMap. The class is not accessible, so store it in a HashMap variable. This method must be used to set the initial value for a variable which loads in a section from config. The key class may only be a type which has converter from string to another type. For obvious reasons, it cannot be a config-mappable object.- Type Parameters:
K- The key typeV- The value type- Parameters:
keyClass- The class of the key typevalueClass- The class of the value type- Returns:
- An empty map of the given type, which will be populated when
load()is called
-
map
public static <K,V> redempt.redlib.configmanager.ConfigMap<K,V> map(Class<K> keyClass, Class<V> valueClass, ConversionType type) Deprecated.Creates a ConfigMap from a given type. A ConfigMap extends LinkedHashMap. The class is not accessible, so store it in a HashMap variable. This method must be used to set the initial value for a variable which loads in a section from config. The key class may only be a type which has converter from string to another type. For obvious reasons, it cannot be a config-mappable object.- Type Parameters:
K- The key typeV- The value type- Parameters:
keyClass- The class of the key typevalueClass- The class of the value typetype- The method which will be used to convert the value type- Returns:
- An empty map of the given type, which will be populated when
load()is called
-
list
Deprecated.Creates a ConfigList from a given type with initial elements. A ConfigList extends ArrayList. The class is not accessible, so store it in an ArrayList variable. This method must be used to set the initial value for a variable which loads a list from config using type converters or mapped objects.- Type Parameters:
T- The type- Parameters:
clazz- The class of the type of the listelements- The elements to initialize the list with- Returns:
- A list of the given type which has been populated with the given elements
-
list
public static <T> redempt.redlib.configmanager.ConfigList<T> list(Class<T> clazz, ConversionType type, T... elements) Deprecated.Creates a ConfigList from a given type with initial elements. A ConfigList extends ArrayList. The class is not accessible, so store it in an ArrayList variable. This method must be used to set the initial value for a variable which loads a list from config using type converters or mapped objects.- Type Parameters:
T- The type- Parameters:
clazz- The class of the type of the listelements- The elements to initialize the list withtype- The method which will be used to convert the stored type- Returns:
- A list of the given type which has been populated with the given elements
-
set
Deprecated.Creates a ConfigSet from a given type with initial elements. A ConfigSet extends LinkedHashSet. The class is not accessible, so store it in a HashSet variable. This method must be used to set the initial value for a variable which loads a set from config using type converters or mapped objects.- Type Parameters:
T- The type- Parameters:
clazz- The class of the type of the listelements- The elements to initialize the list with- Returns:
- A set of the given type which has been populated with the given elements
-
set
public static <T> redempt.redlib.configmanager.ConfigSet<T> set(Class<T> clazz, ConversionType type, T... elements) Deprecated.Creates a ConfigSet from a given type with initial elements. A ConfigSet extends LinkedHashSet. The class is not accessible, so store it in a HashSet variable. This method must be used to set the initial value for a variable which loads a set from config using type converters or mapped objects.- Type Parameters:
T- The type- Parameters:
clazz- The class of the type of the listelements- The elements to initialize the list withtype- The method which will be used to convert the stored type- Returns:
- A set of the given type which has been populated with the given elements
-
collection
public static <T> ConfigCollection<T> collection(Class<T> clazz, ConversionType type, Collection<T> toWrap, T... elements) Deprecated.Creates a ConfigCollection from a given type with initial elements. A ConfigCollection wraps the given collection. This method must be used to set the initial value for a variable which loads a set from config using type converters or mapped objects.- Type Parameters:
T- The type- Parameters:
clazz- The class of the type of the listelements- The elements to initialize the list withtype- The method which will be used to convert the stored typetoWrap- The Collection to wrap- Returns:
- A wrapped collection of the given type which has been populated with the given elements
-
collection
public static <T> ConfigCollection<T> collection(Class<T> clazz, Collection<T> toWrap, T... elements) Deprecated.Creates a ConfigCollection from a given type with initial elements. A ConfigCollection wraps the given collection. This method must be used to set the initial value for a variable which loads a set from config using type converters or mapped objects.- Type Parameters:
T- The type- Parameters:
clazz- The class of the type of the listelements- The elements to initialize the list withtoWrap- The Collection to wrap- Returns:
- A wrapped collection of the given type which has been populated with the given elements
-
addConverter
public <T> ConfigManager addConverter(Class<T> clazz, Function<String, T> load, Function<T, String> save) Deprecated.Adds a type converter, which will attempt to convert a String from config to another type that is not usually able to be stored in config- Type Parameters:
T- The type- Parameters:
clazz- The class of the typeload- A function to convert from a string to the typesave- A function to convert from the type to a string- Returns:
- This ConfigManager
-
getConverter
Deprecated. -
register
Deprecated.Register all the hooks for annotated fields in the the given objects. Pass classes instead if static fields are used.- Parameters:
data- The object to be registered- Returns:
- This ConfigManager
-
configExists
public boolean configExists()Deprecated.- Returns:
- Whether the config file exists
-
saveDefaults
Deprecated.Save default values - initial values in the hook fields - where they do not already exist in the config- Returns:
- This ConfigManager
- Throws:
IllegalStateException- if this ConfigManager has not been registered yet
-
load
Deprecated.Loads all values from config into the annotated hook fields- Returns:
- This ConfigManager
- Throws:
IllegalStateException- if this ConfigManager has not been registered yet
-
save
Deprecated.Saves all values from the annotated hook fields to config- Returns:
- This ConfigManager
- Throws:
IllegalStateException- if this ConfigManager has not been registered yet
-
getConfig
public org.bukkit.configuration.file.YamlConfiguration getConfig()Deprecated.- Returns:
- The configuration this ConfigManager is loading from and saving to
-
ConfigManager. This API will be removed in a future version.