Skip to content

Modules

Gio edited this page Apr 30, 2023 · 1 revision

Moon_UP

Modules

Main File

package be.moondevelopment.example;

import be.moondevelopment.moonapi.framework.modules.ModuleManager;
import org.bukkit.plugin.java.JavaPlugin;

public class ExamplePlugin extends JavaPlugin {

    private static ExamplePlugin instance;

    private ModuleManager moduleManager;

    @Override
    public void onEnable() {
        instance = this;

        // Load the Modules located in the "module" folder
        moduleManager.load("be.moondevelopment.example.module");
    }

    @Override
    public void onDisable() {
        // Unload the Modules located in the "module" folder
        moduleManager.unload();
    }

    public static ExamplePlugin getInstance() {
        return instance;
    }
}
    public YamlConfigUtil getConfig() {
        return config;
    }
}

Test Module "Located in module.test"

package be.moondevelopment.example.module.test;

import be.moondevelopment.moonapi.framework.modules.AbstractModule;

public class TestModule extends AbstractModule {
    public TestModule() {
        // Activate the module
        super(true);
    }

    @Override
    public void onEnable() {
        // Do stuff when the module is enabled
    }

    @Override
    public void onDisable() {
        // Do stuff when the module is disabled
    }
}

Moon_DOWN

Clone this wiki locally