[API] APIManager 1.0.2

Manage API dependencies & include them in your plugins

  1. inventivetalent
    Tested Minecraft Versions:
    • 1.7
    • 1.8
    • 1.9
    This simple API allows you to manage API-dependencies of your plugins.
    You only have to add 2 lines of code to include an API, you can then include the API source code in your plugin file.
    This Manager is primarily made for APIs which have to register events to function, so they usually would have to be installed as separate plugins.


    How-To

    If you are making a Plugin with dependencies:

    1. Make sure the API you depend on supports APIManager
    2. In your plugin's onLoad method call APIManager#require with the API class you require and your plugin instance
    3. In the onEnable method call APIManager#initAPI with the required API class
    4. Add the plugin name of the required API to softdepend in your plugin.yml
    5. You successfully added an API dependency! (Repeat steps 2-4 for all APIs your plugin depends on.)
    6. Finally just compile all of the required API classes with your plugin. Maven is the easiest way to do so.
    > Example Plugin class



    If you are making an API (with dependencies):
    1. Create your API class an implement API
      1. Also implement Listener here if your API has to register events
    2. If your API has dependencies as well:
      1. In the load method call APIManager#require with the API class and null as the plugin instance
      2. in the init method call APIManager#initAPI with the required API class
      3. Add the plugin name of the required API to softdepend in your plugin.yml
      4. (Repeat steps 2.1-2.3 for all APIs your API depends on)
    3. In the init method call APIManager#registerEvents with your API instance (i.e. this) and the Listener to register
    4. If you need an enabled Plugin instance anywhere else (e.g. to run Schedulers) you can use the plugin variable in init or disable, or just call APIManager#getAPIHost with your API instance
    5. Finally just compile all of your API classes and required API classes with your plugin. Maven is the easiest way to do so.
      1. You should also add information on how to implement your API with APIManager to your documentation (i.e. which class to require & init)
    > Example API class
    > Example Plugin class





    Maven
    Code (XML):

    <repository>
        <id>inventive-repo</id>
        <url>https://repo.inventivetalent.org/content/groups/public/</url>
    </repository>
    ...
    <dependency>
        <groupId>org.inventivetalent</groupId>
        <artifactId>apimanager</artifactId>
        <version>1.0.1</version>
    </dependency>

     



    Links

Recent Updates

  1. Minor update
  2. Fix

Recent Reviews

  1. SirFaizdat
    SirFaizdat
    5/5,
    Version: 1.0.2
    Very nice and convenient for API users and API developers alike. Hopefully, more people start using this soon. Thanks so much for this resource (and for all of your other resources too), ma'am :)