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

public class ArcanaAPI<P extends org.bukkit.plugin.java.JavaPlugin> extends Object
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
    Constructor
    Description
    ArcanaAPI(P plugin)
    Creates a new ArcanaAPI bound to the given plugin.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Initializes this API instance: registers it as the singleton returned by getInstance() and logs that initialization completed.
    <C extends ConfigData>
    C
    loadConfig(Class<C> configClass, @Nullable org.bukkit.configuration.ConfigurationSection config)
    Loads the config data from the given class and config.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ArcanaAPI

      public ArcanaAPI(P plugin)
      Creates a new ArcanaAPI bound to the given plugin. This does not register the singleton instance; call init() 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 by getInstance() 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 with ConfigEntry (fields with no matching entry keep their default value)
      Throws:
      IllegalArgumentException - if configClass isn't annotated with Config
      IllegalStateException - if configClass cannot be instantiated