📦Minigame setup

Every minigame must extend MiniGame class.

public class MyMinigamePlugin extends MiniGame 

If you want to set configurators overwrite loadConfigurators method

    @Override
    protected ConfiguratorsInitializer loadConfigurators() {
        return ConfiguratorsInitializer.builder()
                .setGameConfigurator(new MyGameConfigurator())
                .setPluginConfigurator(new MyPluginConfigurator())
                .build();
    }

If you want to set GameManager or loader, other manager or factory, overwrite configure method

Init your own Game Manager.

You must set your own game manager, to define joining, leaving and drawing game.

    @Override
    protected LibraryConfiguration configure() {
        commandsModule = new CommandsModule(this);
        return new LibraryConfiguration(this, getConfiguratorsInitializer())
                .builder()
                .setGameManager(new MyGameManager())
                .registerModules(commandsModule) 
                //new way how to register command module
                .build();
    }

If you want to use config.yml or other configuration YAML set it in initConfiguration method

You must implement this method

    @Override
    protected void initConfiguration() {
        getConfig().options().copyDefaults(true);
        saveConfig();
        //init your configuration classes 
    }

The whole implementation of the minigame main class

public class MinigamePlugin extends MiniGame {

    @Override
    protected void onMiniGameEnable() {
        //define your on enable logic
    }
    
    @Override
    protected void initConfiguration() {
        getConfig().options().copyDefaults(true);
        saveConfig();
        //init your configuration classes 
    }
}

Last updated