Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

How to create a module

KarmaDev edited this page Feb 23, 2022 · 10 revisions

How does the LockLogin API work?

Before knowing how to start with a LockLogin module, you must know how does the API work. As in the other plugins, there's a method, you call it and it does things, the difference between LockLogin and these plugins API, is that LockLogin doesn't want a plugin to use its API, why?, security.

So the only way to interact with LockLogin is creating a module, otherwise you won't be able to interact with it.

Creating your first module

First, create a main class that extends PluginModule.

package com.mymodule.bukkit;

import eu.locklogin.api.common.injector.loader.JarInJarClassLoader;
import eu.locklogin.api.common.injector.loader.LoaderBootstrap;
import eu.locklogin.api.module.PluginModule;

public class Main extends PluginModule {

    /**
     * On module enable logic
     */
    @Override
    public void enable() {
        //Do something
    }

    /**
     * On module disable logic
     */
    @Override
    public void disable() {
        //Do something
    }
}

Module.yml

Before compiling and using the module, you will need to setup a module.yml so LockLogin can read it and use the module.yml information to load your module.

The module.yml looks like this:

name: ModuleName
version: ModuleVersion
description:
  - "This is the module"
  - "description, it can be a string"
  - "an array or even a list"
load: PREPLUGIN #You can also use POSTPLUGIN
author: ModuleAuthor
update_url: "https://mydomain.com/modulename/" #There must exist a latest.txt file
loader_bukkit: path.to.my.main.class.for.bukkit.extending.PluginModule
loader_bungee: path.to.my.main.class.for.bungee.extending.PluginModule
loader_velocity: path.to.my.main.class.for.velocity.extending.PluginModule

latest.txt format

1.0.0
https://mydomain.com/modulename/Latest.jar

LockLogin API has more features, but it will be better for you to check javadocs