# craftjs-plugin

Latest version **0.4.1** (published 2021-06-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install craftjs-plugin
pnpm add craftjs-plugin
yarn add craftjs-plugin
bun add craftjs-plugin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.1 |
| Published | 2021-06-29 |
| First published | 2020-12-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 24 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Maintainers | bensku |

## Links

- npm: https://www.npmjs.com/package/craftjs-plugin
- Repository: https://github.com/Valtakausi/craftjs
- Homepage: https://github.com/Valtakausi/craftjs#readme
- Issues: https://github.com/Valtakausi/craftjs/issues
- npm.io page: https://npm.io/package/craftjs-plugin

## Recent versions

- 0.4.1 (latest) — 2021-06-29
- 0.4.0 — 2021-06-27
- 0.3.3 — 2021-05-01
- 0.3.2 — 2021-04-30
- 0.3.1 — 2021-04-30
- 0.3.0 — 2021-04-29
- 0.2.1 — 2021-02-21
- 0.2.0 — 2021-02-21
- 0.1.5 — 2021-01-30
- 0.1.4 — 2021-01-18
- 0.1.3 — 2021-01-09
- 0.1.2 — 2021-01-02
- 0.1.1 — 2020-12-30
- 0.1.0 — 2020-12-28

## README

# CraftJS
CraftJS is a Bukkit plugin that adds support for writing plugins in TypeScript
and JavaScript.

## Current status
CraftJS is in early development and has little documentation aside of the
JS/Javadocs. No guarantees about API stability are provided.

## Requirements
* Paper (Minecraft 1.17)
  * Spigot would likely be trivial, will be considered later
* GraalVM 21.1 (Java 16 version)
  * Older known not to work, newer versions *might* be ok

## Usage
Tutorials for creating CraftJS plugins will come later. For now, see 'internal'
for a JS plugin example. If you copy the package.json from there, make sure to
change dependency 'craftjs-plugin' to latest version from npm.

To install CraftJS, just copy the jar file to your plugins folder.

## Development
CraftJS can be built with 'build.sh' script available at repository root.
Unfortunately, only Linux is supported for building at the moment.

More development instructions will come later.

## Technical details
JavaScript is executed with [GraalJS](https://github.com/oracle/graaljs), which
(unline Nashorn) supports modern JavaScript features. CraftJS itself provides

* JavaScript plugin loader implementation
* require() implementation with Java import support (for TypeScript)
* Bukkit scheduling helpers
* Event handler and command registration support
* Various standard library function implementations/polyfills

TypeScript types are [generated](https://github.com/bensku/java-ts-bind)
automatically from Java source code and include Javadoc. They are available
on npm as 'craftjs-plugin'.

### Components
CraftJS consists of the following components that can be found in directories
with similar names:
* core: Javascript core
  * Provides core APIs (e.g. require) to JS plugins
  * Injected to each Graal context before loading JS plugin
* internal: CraftJS JS plugin
  * Internal JS plugin that provides e.g. /craftjs command
  * Has access to internal APIs from java component
* java: CraftJS Java code
  * Maven project with all our Java code

## Differences from ScriptCraft
CraftJS is inspired by an older scripting plugin,
[Scriptcraft](https://github.com/walterhiggins/ScriptCraft). Despite the
obvious similarities, the two plugins have several important differences:

* CraftJS uses [GraalJS](https://github.com/oracle/graaljs) instead of Nashorn
  * Better support for new JS features
  * (Usually) better performance
* CraftJS has TypeScript types
  * Autocomplete (and import) Bukkit classes!

---
_Source: https://npm.io/package/craftjs-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
