Every minigame must extend MiniGame class.
public class MyMinigamePlugin extends MiniGame
You must implement two abstract methods getPlayerCommand and getAdminCommand.
These two methods are important to the addon system.
@Override
public ParentCommand getPlayerCommand() {
return new PlayerCommand();
}
@Override
public ParentCommand getAdminCommand() {
return new AdminCommand();
}
Sets two configurators before you call super.onEnable.
setDefaultGameConfigurator(new MyGameConfigurator());
setDefaultPluginConfigurator(new MyPluginConfigurator());
If you don't set these configurators, will apply default configurators.
super.onEnable(); //don't forget about this, it's very important
Set your command configurator:
setDefaultCommandConfigurator(new MyCommandConfigurator());
Init your own Game Manager.
You must set your own game manager, to define joining, leaving and drawing game.
setGameManager(new MyGameManager();
Register default listeners:
This method is important to define default listeners system
super.registerGameListeners();
On the end call loadAll method to load all data to default systems.
getLoaders().loadAll();
The whole implementation of the minigame main class
public class MinigamePlugin extends MiniGame {
@Override
public void onEnable() {
setDefaultGameConfigurator(new MyGameConfigurator());
setDefaultPluginConfigurator(new MyPluginConfigurator());
super.onEnable(); //don't forget about this, it's very important
setDefaultCommandConfigurator(new MyCommandConfigurator(messages));
setGameManager(new MyGameManager();
super.registerGameListeners();
getLoaders().loadAll();
}
@Override
public ParentCommand getPlayerCommand() {
return new TheTagCommand();
}
@Override
public ParentCommand getAdminCommand() {
return new AdminTheTagCommand();
}
}
Last updated