I am thinking about creating a small api that could take in an item id, return a material name, and vice versa. It would also be able to take in aliases and return any other thing (Material, ID, etc) How do I make my methods visible to other plugins?
First off you would be looking for a public static method. Second the Material enum already has built in methods to do that.
If you wanna know exactly how to do this you basically just make a plugin and do nothing with the main class (JavaPlugin) but load it. Then you would create your other classes and yes you would use the public keyword. And i don't know what you are using to create your plugins so I wouldn't know how to load your API so you can test it. But you would put the API jar file in the plugins folder.
Thanks, I think I'll make a small test plugin to test it. It shouldn't be to hard, all it will do is look something up form a file
The proper way to create an API is through registering a service interface with bukkit. Other plugins can then ask bukkit for providers of that service.
Bukkit has a service manger. Plugins can register A service interface accompanied by a provider of that service. The other plugin can request all providers of a service interface.
Why would clients need to know the provider of the service? That kind of voids the purpose of interfacing... Sounds nice; mind linking me to the package that contains this (in the Git repo)?
They don't know the implementation, only that the return object implants the interface. But since it is an object you call methods on, it is still an implementing class. The Javadoc for the ServicesManager can be found here
That's true but is irrelevant to my question. It's not a matter now because I realized that your statement had a different meaning than what I originally interpreted it to mean; and I have no questions on the new interpretation. Thank you for your information about Bukkit's service manager; this is useful to study because I and others can use a similar idea for future libraries we create.