-
Notifications
You must be signed in to change notification settings - Fork 0
Implementation Docs
RepCraft is implemented as a spigot api JavaPlugin
Graalvm is a platform where many languages (polyglot) can run in the same environment.
RepCraft uses this to have JavaScript interop with Java
Graalvm runs a JVM (Java Virtual Machine) that takes place of Oracle's
Which the minecraft spigot server needs to launch inside of
This allows RepCraft to access the polyglot api and run JavaScript
Under the hood, RepCraft simply looks in <spigot>/repcraft/js-plugins
for sub-directories that have a package.json file in them.
RepCraft uses Gson for parsing JSON,
this was chosen because spigot loads gson already.
When it finds package.json it attempts to read main property
which it tries to treat as a JavaScript file path run in graalvm.
As per graalvm docs, sources that end in .mjs are treated as ES Modules.
A more advanced implementation of spigot Listener class.
It registers itself as a handler of every event type,
and provides a JavaScript exposed API for listening in JS.
This one is pretty simple
it is a regular minecraft command processor that
joins the command text into a single string
and feeds it into graalvm for evaluation
Permissions are not yet implemented.