Skip to content
SenkJu edited this page Sep 3, 2019 · 8 revisions

Description

Each module, command or inventory tab has to be registered in the script's body otherwise it will not be available in the client. The script API offers different managers for inventory tabs, modules and commands. They can also be used to retreive modules or commands from the client.

Register an inventory tab

functionInventoryTab(){// ...}varinventoryTab=newInventoryTab();functiononLoad(){creativeTabs.registerTab(inventoryTab);}

Register a module

functionModule(){// ...}varmyModule=newModule();// The module has to be instantiated before it can be registered.functiononEnable(){moduleManager.registerModule(myModule);}functiononDisable(){moduleManager.unregisterModule(myModule);}

Register a command

functionCommand(){// ...}// References abovevarcommand=newCommand();functiononEnable(){commandManager.registerCommand(command);}functiononDisable(){commandManager.unregisterCommand(command);}

Retreive a module

// Gets a module from the ModuleManager (Returns module)varkillAuraModule=moduleManager.getModule("KillAura");varname=killAuraModule.getName();// Returns the name of the module (String)vardescription=killAuraModule.getDescription();// Returns the description of the module (String)varcategory=killAuraModule.getCategory();// Returns the category of the module (String)varstate=killAuraModule.getState();// Returns whether a module is toggled (Boolean)varkeyBind=killAuraModule.getBind();// Returns the code of the key the module is bound to (Integer)varrange=killAuraModule.getValue("Range");// Gets a value of the module range.set(2.5);// Sets range value to 2.5range.get();// Gets value of range (2.5)killAuraModule.setState(true);// Enables the modulekillAuraModule.setState(false);// Disables the modulekillAuraModule.setBind(-1);// Sets the bind of a module to a key code (Takes Integer)killAuraModule.unregister();// Unregisters the module from the ModuleManagerkillAuraModule.register();// Registers the module to the ModuleManager

Execute a command

commandManager.executeCommand(command,arguments);commandManager.executeCommand(command);// ExamplecommandManager.executeCommand(".help");

Clone this wiki locally