Skip to content

Latest commit

 

History

History
70 lines (57 loc) · 1.76 KB

README.md

File metadata and controls

70 lines (57 loc) · 1.76 KB

ModLoader

Nukkit plugin, enable to load javascript! very simple create systems!! Nukkit plugin - Allows you to load Javascript modules!

How to use?

Basic JavaScript API loaded!

  • Global Variables:
var server; return getServer();
var plugin; return ModLoader Plugin MainClass;
var manager; return FunctionManager Class, Using to create Commands e Loops
var logger; return Console Logger Input
var players; return All Online Players
  • Create Basic Command:
manager.createCommand("name", "description", "functionUsed");


function functionUsed(sender, args){
    if(args.length < 1){ // see args exists
        sender.sendMessage('You used incorrect!');
        return;
    }
    var name = args[0];
    sender.sendMessage("You writer: " + name); // send Message to sender
    // sender.sendMessage(manager.format("You writer: %s", name)); format your message
}
  • Create Basic Tasks:
manager.createTask("tasknormal", 20 * 20);

manager.createLoopTask("taskloop", 20 * 20);

function tasknormal(currentTick){
    print('I tasknormal!');
}

function taskloop(currentTick){
    print('I taskloop');
}
  • Run Events:
function PlayerJoinEvent(event){
    var player = event.getPlayer();
    player.sendMessage("welcome to Server!");
}

// function BlockBreakEvent(event){}
// ready, start your server and test!
  • Create Config
var config = manager.createConfig(manager.getFile("folder", "archive"), 2); // 2 = Config.YAML

config.set("key", "value");
config.save();