Skip to content
This repository was archived by the owner on Feb 8, 2025. It is now read-only.

Scripting: modules

smokingplaya edited this page Jul 25, 2024 · 1 revision

JavaScript ESM

Well, you can certainly use npm modules, but with 99% probability
they will not work correctly. This is because JointJS is built on
GraalJS and it is not backward compatible with Node.JS, i.e. it doesn't
have most of the features from Node.JS. Anyway, nobody forbids
you to use modules from npmjs.
I'll say more - our main module (@joint-js/modules) is distributed
via npm, but that's only because it mostly contains interfaces
and classes, for backward compatibility with Java classes, etc.
In general, our plugin functionality is built on
our npm module - @joint-js/modules.

Java

In addition to esm, you can get classes directly from Java.
To get a Java class you need to use Java.type() method
Example:

import JavaObject from “@joint-js/modules/classes”;

const server: JavaObject = Java.type(“org.bukkit.Server”);

You can read more here

Clone this wiki locally