helper js: Bindings - lucko/helper GitHub Wiki
"Bindings" refers to a feature exposed in the Java Scripting API. Expressed simply, bindings represent the objects, mapped to keys (variable names) which are available during the scripts execution.
The bindings provided by helper are encapsulated by SystemScriptBindings
, and implemented by HelperScriptBindings
.
helper itself provides a number of bindings for convenience:
exports
- these are explained laterserver
- the Bukkit server instanceplugin
- the helper-js plugin instanceservices
- the Bukkit services managercolorize
- a function which accepts a string, and passes it throughColor#colorize
newMetadataKey
- a function which accepts a string, and returns a newMetadataKey
for the object.
Plus a number of more general bindings for working with Java objects:
- newArrayList
- newLinkedList
- newHashSet
- newHashMap
- newCopyOnWriteArrayList
- newConcurrentHashSet
- newConcurrentHashMap
- listOf
- setOf
- immutableListOf
- immutableSetOf
Each script then appends its own bindings.
loader
- the script loader which loaded the script. Useful if you want to load dependant scripts independentlyregistry
- a TerminableRegistry instance used by the scriptlogger
- the scripts logger instancecwd
- the "current working directory" - effectively the scripts location relative to the loader directoryrsd
- the "root scripts directory" - the path (relative to the server root) to the scripts directory