API

How to use developer api or acces?

Javadoc (Coming Soon)

Maven:

Add this to your pom.xml if you use in maven.

<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository>
<dependency>
    <groupId>com.github.minetrone</groupId>
    <artifactId>api-mnavigation</artifactId>
    <version>{RELEASE-VERSION}</version>
</dependency>

Gradle:

Add this to your build.gradle if you use in gradle.

repositories {
    maven { url 'https://jitpack.io' }
}
dependencies {
    compileOnly 'com.github.minetrone:api-mnavigation:{RELEASE-VERSION}'
}

How to use?

MNavigationAPI has good javadoc.

You can check it out the mnavigation javadoc Java-Doc(Coming Soon)

public class Main extends JavaPlugin {
    // Returns Main class of plugin
    Main mnavigationMain = MNavigationAPI.getInstance();
    // Gets storage manager
    StorageManager storageManager = MNavigationAPI.getStorageManager();
    // Gets adventure manager
    ModuleManager adventureManager = MNavigationAPI.getAdventureManager();
    // Gets navigation manager
    NavigationManager navigationManager = MNavigationAPI.getNavigationManager();
    // Gets modules manager
    ModulesManager modulesManager = MNavigationAPI.getModulesManager();
}

Listeners

  • NavigationFollowEvent

  • NavigationUnFollowEvent

Create custom module

MNavigationModule are similar to plugins. The difference between them and regular plugins is that the modules are designed to work only with MNavigation, and they are loaded by MNavigation and not by the server.The advantages of using modules over plugins is the ability to manage them through the plugin's commands, without needing to restart the server. Moreover, MNavigation handles listeners and commands for you - it will register them when needed, unregister them and will do all of that work for you.

Example Module Creation

public final class ExampleModule extends MNavigationModule {

    private static ExampleModule INSTANCE;
    private MNavigation plugin;

    private Config config;
    private boolean enabled = false;

    public ExampleModule() {
        super("ModuleName", "AuthorName");
        INSTANCE = this;
    }
    
    @Override
    public void onEnable(MNavigation plugin) {
        try {
            this.plugin = plugin;
            // Example config init
            config = MNavigationAPI.getStorageManager().initModuleConfigFile(getName(), "config", plugin, getResource("config.yml"));
            // Module can be enable?
            if (config.getBoolean("enabled"))
                enabled = true;
        } finally {
            if (!enabled)
                getLogger().warning("Example module failed to load!");
        }
    }

    @Override
    public void onReload(MNavigation plugin) {}

    @Override
    public void onDisable(MNavigation plugin) {}

    @Override
    public @Nullable Listener[] getModuleListeners(MNavigation plugin) {
        return new Listener[0];
    }

    @Override
    public ModuleLoadTime getLoadTime() {
        return ModuleLoadTime.NORMAL;
    }

    public static GeyserModule getModule() {
        return INSTANCE;
    }

    public MNavigation getPlugin() {
        return plugin;
    }

    public Config getConfig() {
        return config;
    }
}

Last updated