🔌What is module ?

The module is a separated JAR which adds more functions to core library.

Module must be shade in your plugin JAR, thanks to maven or gradle.

Every module must be registered in configure method in your Main class.

How to register module?

Module can be registered in two ways.

  1. Simple module registration, by put new instance of module to registerModules method

  2. Load before others modules, but put new instance of module in to constructor of LibraryConfiguration class.

The first way:

    @Override
    protected LibraryConfiguration configure() {
        return new LibraryConfiguration(this, getConfiguratorsInitializer())
                .builder()
                .setGameManager(new MyGameManager(this, settings, messages))
                .registerModules(new MyModule(), new MySecondModule())
                .build();
    }

The second way:

This way to register module, must be used rarely, only in exceptional situations.

    @Override
    protected LibraryConfiguration configure() {
        commandsModule = new CommandsModule(this);
        return new LibraryConfiguration(this, getConfiguratorsInitializer()
                , Arrays.asList(new MyModule(), new MySecondModule()))
                .builder()
                .setGameManager(new MyGameManager(this, settings, messages))
                .build();
    }

Last updated