-
Notifications
You must be signed in to change notification settings - Fork 4
Obtaining an API Instance
iso2013 edited this page Apr 25, 2018
·
2 revisions
Due to the way PacketEntityAPI supports shading, you must call a static initializer function in your #onEnable to get an instance. The method accepts a plugin object and a function to run once the API is complete. This function is where you should register listeners and store a copy of the API for later use. For example:
public class ExamplePlugin extends JavaPlugin {
private IPacketEntityAPI instance;
public void onEnable() {
PacketEntityAPI.initialize(this, api -> this.instance = api);
}
}