Implementation


ClassAPI

Current Version - Version 1.1

For CraftBukkit - 1.6.2-R0.1


Links


Implementation

So, you're a plugin developer wanting to use ClassAPI in your next plugin? Great! There isn't much to do to get started!

  1. Download ClassAPI.jar and add it to your build path, just as you do for bukkit jars.
  2. Be sure to add
    depend: [ClassAPI] 
    
    to your plugin.yml!
  3. Now comes the slightly more complicated part. All you need to do is create an instance of the ClassAPI object.
    1. Firstly, create a check for the plugin to ensure that the server owner is using it,
      ClassAPI classAPI;
      private boolean initClassAPI(){
          if (getServer().getPluginManager().getPlugin("ClassAPI") == null)
              return false;
          classAPI = new ClassAPI("directory/to/save/configuration/files/in");
          return true;
      }
      
      Where in the constructor of the ClassAPI instance you put the directory you wish the configuration files would be stored in. You may leave it blank and use new ClassAPI(); and the plugin would use the default configuration directory, plugins/ClassAPI/ You call the example method above in your onEnable, if you were wondering. A smart idea would be to disable your plugin if the initClassAPI() method returns false while printing to the console that the API is needed.
      public void onEnable(){
          if(!initClassAPI()){
              getServer().getPluginManager().disablePlugin(this);
              Logger.getLogger("Minecraft").info("[PluginName] Required dependency 'ClassAPI' not found! Disabling plugin...");
          }
      }
      
    2. Now your classAPI instance is ready to go! Please refer to the source for more information on what you can do with your new classAPI instance!


Comments

Posts Quoted:
Reply
Clear All Quotes