0.4.1 • Published 3 years ago

craftjs-plugin v0.4.1

Weekly downloads
107
License
MIT
Repository
github
Last release
3 years ago

CraftJS

NOTE: Under heavy development

Spigot Plugin that allows programming custom functionality for your server using Javascript. Inspired heavily by Scriptcraft but trying to address some of it's issues.

CraftJS Javascript

Repository containing base Javascript code for CraftJS responsible for implementing basic Node-like functionality (partially CommonJS -compatible module resolvation, setTimeout and setInterval , Spigot event registration, etc...)

Differences to Scriptcraft

CraftJS and Scriptcraft are both essentially just a Javascript engine wrapped into a Spigot plugin. Scriptcraft uses now deprecated Nashorn -engine, while CraftJS uses Graal. This allows the executing code to use more recent (ES6+) Javascript features without using transpilers (like Babel), and should also allow for much better performance.

Getting started

Installation

NOTE: CraftJS requires you to use Paper

Download the plugin jar from releases or build the code directly from source. More info here

Contributing

The plugin's java code is located at java . The internal Javascript code, mostly coded in Typescript, can be found under internal . Development time compilation can be done by executing npx tsc --watch at internal . internal/dist contains compiled js-files, and they are executed by the plugin.

Building the plugin from source

  1. Make sure you have maven installed
  2. Download and install Graal Java runtime and make sure it's configured as your default Java (executing java -version should say OpenJDK Runtime Environment GraalVM )
  3. Run mvn install in the java -directory
  4. Copy the built jar from java/target to your server's plugins-folder

Testing

Unit tests can be run by executing runTests() in the CraftJS Graal-context. Easiest way to do so is to run js runTests() -command in the server console.

Typescript

types -directory contains Typescript definitions generated from Java types. It's not perfect, but most of the time it's been enough.

More information is available here

0.4.1

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.3

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago