-
Notifications
You must be signed in to change notification settings - Fork 1
Getting Started with the API
James Harrell edited this page Jan 13, 2021
·
7 revisions
Page Updated v0.0.1.
The API is really easy to learn, so I am first going to explain the general layout of everything.
The API is laid out as follows:
- API
- Manager
method()
- Manager
In practice, this would look something like this:
-
ModuCoreAPI-
PlayerManagergetName(UUID)
-
you would then do moduCoreApi.playerManager.getName(uuid).
This is the Preferred Way! To use this method, you would want something similar to the following code:
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
public class MyPlugin extends JavaPlugin {
private ModuCoreAPI moduCore;
public ModuCoreAPI getModuCore() {
return moduCore;
}
@Override
public void onEnable() {
RegisteredServiceProvider<ModuCoreAPI> rsp = getServer().getServicesManager().getRegistration(ModuCoreAPI.class);
if (rsp != null) {
moduCore = rsp.getProvider();
}
}
}Now that you know how the API is laid out, you need to get an instance of the API. You can do this with ModuCoreAPI#getInstance().
From here, you are all set to start using the API. The next place you should go is the documentation found at docs.jaims.dev. If you have any questions, please join the discord below!
Discord Support: discord.jaims.dev