OpenJS-docs
Download plugin
  • Overview
    • Welcome
  • Getting Started
    • Installing the plugin
    • Configuration file
    • Commands
    • Creating scripts
  • OpenJS Components
    • Feature Flags
    • Managing scripts within scripts
    • Sharing variables between scripts
    • Custom Commands
    • Using PlaceHolderApi
    • Listening and cancelling events
    • Custom events
    • Loading and saving data
    • Logging in console
    • Scheduling
    • Java imports
  • Example Scripts
    • spawn hit stand command
    • Knockbackstick command
    • No hit-cooldown script
    • NoBlockPlacing script
    • Saving Player data script
    • running code asynchronously
    • WhileTrue do script
Powered by GitBook
On this page
  1. OpenJS Components

Custom events

// Executes whenever a script gets loaded
registerEvent("coolcostupit.openjs.events.ScriptLoadedEvent", {
    handleEvent: function(event) {
        var scriptName = event.getScriptName();
        log.info("Script got loaded: " + scriptName);
    }
});

// Executes whenever a script gets unloaded/disabled
registerEvent("coolcostupit.openjs.events.ScriptUnloadedEvent", {
    handleEvent: function(event) {
        var scriptName = event.getScriptName();
        log.info("Script got unloaded: " + scriptName);
    }
});

This is not a complete documentation on custom events

PreviousListening and cancelling eventsNextLoading and saving data

Last updated 7 days ago