API: Use it in your code

Now write into your onEnable() part:

//check that Help++ is installed and enabled
if(getServer().getPluginManager().getPlugin("HelpPlusPlus") != null) {
if(getServer().getPluginManager().getPlugin("HelpPlusPlus").isEnabled()) {
        		
//create an variable in this case api	
HelpPlusPlus api = (HelpPlusPlus) Bukkit.getServer().getPluginManager().getPlugin("HelpPlusPlus");
System.out.println("[UpdateStatus] It seems that HelpPlusPlus is installed and actually enabled, try to sent plugin information...");
//write all your commands, descriptions and permissions in arrays, 
//note: cmds[0] must be the command which has perms[0] as permission
String[] cmdsEN = {"status","bstatus","usreload"};
String[] descsEN = {"Shows the status of <argument>","Broadcasts the status of <argument>","Reload the plugin config.yml"};
String[] permsEN = {"UpdateStatus.status","UpdateStatus.bstatus","UpdateStatus.usreload"};
//use the addCommands method so "plugin name", int (count up at every update begin with 1), "language code like used on devBukkit", arrays
api.addCommands("UpdateStatus", 5, "enUS", cmdsEN, descsEN, permsEN);
//same for other languages
String[] cmdsDE = {"status","bstatus","usreload"};
String[] descsDE = {"Zeigt den Status von <argument>","Broadcastet den Status von <argument>","Laedt die config.yml neu"};
String[] permsDE = {"UpdateStatus.status","UpdateStatus.bstatus","UpdateStatus.usreload"};
api.addCommands("UpdateStatus", 5, "deDE", cmdsDE, descsDE, permsDE);

String descriptionEN = "Displays you several informations about things setup in the configuration file.";
String descriptionDE = "Zeigt dir verschiedene Informationen zu Dingen, die in der Konfigurationsdatei eingestellt wurden.";
String version = this.getDescription().getVersion();
api.setPluginInformations("UpdateStatus", descriptionEN, "enUS", version);
api.setPluginInformations("UpdateStatus", descriptionDE, "deDE", version);
System.out.println("[UpdateStatus] Sent plugin information.");
}
}
else {
System.out.println("[UpdateStatus] This plugin would support Help++");
}

Now you have succesfully added official support for HelpPlusPlus - Thank you!


Comments

Posts Quoted:
Reply
Clear All Quotes