📦Minigame setup

The library requires T-DataBasesAPI on Paper 1.20.6 and newer versions.

https://github.com/timsixth/T-DataBasesAPI/releases

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())
                //.setCommandConfigurator(new MyCommandConfigurator()) 
                //old way how to register command module
                .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 
    }
super.onEnable(); //don't forget about this, it's very important

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() { 
        super.onEnable(); //don't forget about this, it's very important

        getLoaders().loadAll();
    }
    
}

Last updated