Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jwulf/camunda-minecraft-plugin
The Camunda Engine embedded in a Minecraft plugin
https://github.com/jwulf/camunda-minecraft-plugin
camunda minecraft scriptcraft
Last synced: about 1 month ago
JSON representation
The Camunda Engine embedded in a Minecraft plugin
- Host: GitHub
- URL: https://github.com/jwulf/camunda-minecraft-plugin
- Owner: jwulf
- Created: 2020-01-21T00:15:05.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-01-21T23:36:47.000Z (almost 3 years ago)
- Last Synced: 2024-04-14T15:01:47.591Z (7 months ago)
- Topics: camunda, minecraft, scriptcraft
- Language: Kotlin
- Size: 423 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CamundaCraft - The Minecraft BPMN Plugin
![](img/CamundaCraft.jpg)
_Orchestrate Minecraft with BPMN and JavaScript!_
The Camunda Engine embedded in a Minecraft plugin for Bukkit-compatible Minecraft servers.
The plugin has a single delegate method for task execution. The executor uses a field injection named `delegate` from a service task.
It uses the value of this field to look up a JavaScript handler in a map.
Any .bpmn and .js files in `plugins/CamundaPlugin` will be loaded. Take a look at the files in [test-data](test-data) for the format of the .js file.
Register the handlers using the `registerHandler(name, code)` method. See the example below.
## Try it out!
If you have docker and npm installed, it is easy to test using the [Scriptcraft Modular Architecture](https://github.com/Magikcraft/scriptcraft-modular-arch) image.
Run:
```
npm i -g smac
mvn package
smac
```This will start a Minecraft server in Docker and mount the plugin into it.
It will pipe the server log to your terminal, and - _bonus!_ - give you an interactive session.
When the server finishes booting, type: `ts on`. This turns the terminal into a TypeScript REPL on the server. _Magic_.
Now paste these commands in:
```typescript
const xml = `SequenceFlow_0krhw54SequenceFlow_0tmt5j8someFunctionSequenceFlow_0tmt5j8SequenceFlow_0krhw54`const c = server.getPluginManager().getPlugin("CamundaPlugin")
c.registerHandler("someFunction", "function(execution) { var process = execution.getProcessInstanceId(); __plugin.logger.info('Yay!!! The job handler was called from process instance ' + process )}")
c.deployBpmn("model.bpmn", xml);
c.runtimeService.createProcessInstanceByKey("my-project-process").execute()
```You will see the handler execute:
```
[02:14:06 INFO]: [CamundaPlugin] Yay!!! The job handler was called from process instance 24
```_Epico!_
To shut down the server, type: `smac stop`.