Phantom Plugins
The base plugin class and how it is wrapped
Phantom plugins simply wrap the controller's ability to do what a controller should do, along with the ability of being a plugin. Its simply explained with this diagram
Explanation of Execution
Essentially the reason why there are two enables and disables is because you need to register sub-controllers somewhere, and since java plugins are initialized elsewhere, the enable is designed to register controllers. The onStart() is designed to be called when all your sub controllers (and their sub controllers) have been started. The root controller is the last to be "started".
NOTE: DO NOT USE onEnable() or onDisable(). Use enable() and disable()
Creating the Plugin
When creating the phantom plugin, you only need to have 3 things for it to be valid
package org.phantomapi.example;
import org.phantomapi.construct.PhantomPlugin;
public class ExamplePlugin extends PhantomPlugin
{
@Override
public void enable()
{
}
@Override
public void disable()
{
}
}
Ghost Plugin
For finer events, use the Ghost plugin as your base instead of PhantomPlugin
package org.phantomapi;
import org.phantomapi.construct.Ghost;
public class ExamplePlugin extends Ghost
{
@Override
public void preStart()
{
//This is effectivley the onEnable()
//Use this to init and register configs
}
@Override
public void onStart()
{
//This is called when all your controllers have started
//Use this to load configs just like controllers
}
@Override
public void onStop()
{
//This is called when all of your controllers have stopped
}
@Override
public void postStop()
{
//This is the last thing called before disable
}
}