https://github.com/electronstudio/python-minecraft-plugin
The Bukkit sample plugin modified to compile with gradle+paperMC+graalVM
https://github.com/electronstudio/python-minecraft-plugin
Last synced: about 2 months ago
JSON representation
The Bukkit sample plugin modified to compile with gradle+paperMC+graalVM
- Host: GitHub
- URL: https://github.com/electronstudio/python-minecraft-plugin
- Owner: electronstudio
- Created: 2020-04-18T16:34:41.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-18T16:49:13.000Z (about 6 years ago)
- Last Synced: 2025-10-23T20:19:36.394Z (8 months ago)
- Language: Java
- Size: 55.7 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This is a proof-of-concept to show that Minecraft can execute Python code.
The only new code I've added to the sample is this bit:
```java
Context polyglot = Context.create();
Value array = polyglot.eval("python", "[1,2,42,4]");
int result = array.getArrayElement(2).asInt();
System.out.println(result);
getLogger().info("POLYGLOT "+result);
```
This is just a single array from Python, not an entire plugin, but it proves it works.
## Setup
1. Download and unzip GraalVM: https://github.com/graalvm/graalvm-ce-builds/releases
2. Install Python for GrallVM:
`~/Downloads/graalvm-ce-java8-20.0.0/Contents/Home/bin/gu install python`
3. Download PaperMC minecraft server (fork of Spigot): https://papermc.io/downloads
4. Check that you can run PaperMC using GraalVM
`~/Downloads/graalvm-ce-java8-20.0.0/Contents/Home/bin/java -jar paper-*.jar`
5. Compile the sample plugin:
`./gradlew jar`
6. Copy the generated plugin jar into the plugins folder of PaperMC and re-run paperMC.
`cp build/libs/*.jar ~/papermc/plugins/`