Discussion in 'Plugin Development' started by calebbfmv, Aug 18, 2012.
I need to make an API for a plugin I made so that with another plugin I can use some features in it.
You add the "public" modifyer to the methods that are part of the API, then in the other other plugin would import your plugin and use those methods. It is also very helpful to document your methods especially if other people won't have the source.
No no, I need to make an API first. I really hope I am understanding this ok
He just told you how to do it..
I find it helpful to put all of your API methods in one class, then delegate them out as you need to, that way you don't have to import a crap load of classes.
The more proper option is to publish a service via bukkit's service manager.
MCMMO has a nice approach - see https://github.com/mcMMO-Dev/mcMMO/tree/master/src/main/java/com/gmail/nossr50/api
They have a static class for each group of API commands, which links into the plugins internal structure. So the API can stay consistent, while the internal structure and methods of your plugin can change when required without affecting the public API.
I was trying not to confuse him, lol.
Separate names with a comma.