Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 12
Managers
SenkJu edited this page Sep 3, 2019
·
8 revisions
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.
functionInventoryTab(){// ...}varinventoryTab=newInventoryTab();functiononLoad(){creativeTabs.registerTab(inventoryTab);}functionModule(){// ...}varmyModule=newModule();// The module has to be instantiated before it can be registered.functiononEnable(){moduleManager.registerModule(myModule);}functiononDisable(){moduleManager.unregisterModule(myModule);}functionCommand(){// ...}// References abovevarcommand=newCommand();functiononEnable(){commandManager.registerCommand(command);}functiononDisable(){commandManager.unregisterCommand(command);}// 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 ModuleManagercommandManager.executeCommand(command,arguments);commandManager.executeCommand(command);// ExamplecommandManager.executeCommand(".help");