Script.throttle(key, intervalMs) is useful inside frequent events:
Script.cleanup(fn) runs fn when the script runtime is disabled or unloaded. Use it to release external handles that are not already script-owned.
Script.thread(fn) starts a daemon thread when the module is enabled. Use it for sleeps or long waits:
Time.sleep and Time.sleepTicks must not run in client-thread event callbacks or packet callbacks.
Async
Async provides cancellable handles for worker functions, delayed callbacks, repeated callbacks, polling, and HTTP requests.
Async.request accepts either a URL string or a request object:
Responses include
status, headers, and body for text requests. For binary responses, pass binary = true; the response includes bodyBytes / bytes as a Java byte array plus length.
id, kind, cancel(), running(), done(), failed(), error(), and result().