Package net.paulem.arcana
Class ArcanaAPI<P extends org.bukkit.plugin.java.JavaPlugin>
java.lang.Object
net.paulem.arcana.ArcanaAPI<P>
- Type Parameters:
P- the type of the plugin this API instance is bound to
Central entry point of the Arcana API for a given plugin.
Holds the singleton instance reachable through
getInstance() once init() has been called,
and provides reflection-based config loading via loadConfig(Class, ConfigurationSection).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidinit()Initializes this API instance: registers it as the singleton returned bygetInstance()and logs that initialization completed.<C extends ConfigData>
CloadConfig(Class<C> configClass, @Nullable org.bukkit.configuration.ConfigurationSection config) Loads the config data from the given class and config.
-
Constructor Details
-
ArcanaAPI
Creates a new ArcanaAPI bound to the given plugin. This does not register the singleton instance; callinit()for that.- Parameters:
plugin- the plugin this API instance is bound to
-
-
Method Details
-
init
public void init()Initializes this API instance: registers it as the singleton returned bygetInstance()and logs that initialization completed. -
loadConfig
public <C extends ConfigData> C loadConfig(Class<C> configClass, @Nullable @Nullable org.bukkit.configuration.ConfigurationSection config) Loads the config data from the given class and config.- Parameters:
configClass- The config class to load.config- The configuration section to load from, or null to use the default spigot configuration.- Returns:
- a new instance of
configClass, populated with the values found in the config section for every field annotated withConfigEntry(fields with no matching entry keep their default value) - Throws:
IllegalArgumentException- ifconfigClassisn't annotated withConfigIllegalStateException- ifconfigClasscannot be instantiated
-