walterhiggins / ScriptCraft

Write Minecraft Plugins in JavaScript.
MIT License
1.84k stars 380 forks source link

ScriptCraft - Potential Compatibility Issue with Minecraft 1.15.2 + JRE #423

Closed ghost closed 4 years ago

ghost commented 4 years ago

Java Version: 1.8.0_241 Client Version: Vanilla 1.15.1 Server Version: Paper 1.15.1 (build 62) https://github.com/PaperMC/Paper/commit/d4ae43fc008221c475f9938ade5ded3ea0b2badc

Error Log:

21.01 21:10:10 [Server] INFO Enabling scriptcraft v3.4.0-2019-01-20*
21.01 21:10:10 [Server] ERROR No JavaScript Engine available. ScriptCraft will not work without Javascript.
21.01 21:10:10 [Server] Startup Done (19.548s)! For help, type "help"
nanocodex commented 4 years ago

I use Spigot 1.15.1 and that message doesn't appear for me.

nanocodex commented 4 years ago

Maybe this will help?

nanocodex commented 4 years ago

Or maybe your Java version is outdated? You can type java -version at the command prompt to check the version of Java that you're using.

ghost commented 4 years ago

I'm using the latest version of Java. This was tested with the latest paper version at the time with the latest version of Java on a local machine, as well as a shockbyte server. I will run it with spigot and see what happens.

ghost commented 4 years ago

@nanocodex can you send me your spigot JAR that works?

nanocodex commented 4 years ago

Unfortunately, Github says that the file is over 10MB. So here's a link to download Buildtools instead (Buildtools will help prevent the spigot server from crashing, along with installing the server) : https://www.spigotmc.org/wiki/buildtools/ The instructions to create a 1.15.1 spigot server will be in the description of the website as well.

nanocodex commented 4 years ago

Nevermind, turns out that I was using an outdated build of version 1.15.1, so I think it's the server that's broken.

Cass-dev-web commented 4 years ago

@hb432 Dude, switch to CRAFTBUKKIT. It now works for me!

jwmiii commented 4 years ago

I'm new to ScriptCraft and the mc server. I was just trying to set this up and get it running. I had installed the Java JRE and I got this error. When I installed the Java JDK this error went away and scriptcraft seems to be working.

ghost commented 4 years ago

The issue seems to start at paper version 63, I am submitting an issue on the paper github page to have this looked into further.

ghost commented 4 years ago

Version 63 was the version paper (and upstream bukkit & spigot) were updated to 1.15.2. This is looking more and more like a compatibility issue with this new version of the game.

ghost commented 4 years ago

@walterhiggins @jwulf Walter, ScriptCraft now requires the JDK (Java SE 13.0.2) to run as of Minecraft 1.15.2. I thought that knowing this might be useful information, wouldn't have pinged you and Wulf otherwise.

jwulf commented 4 years ago

I am using build #71 of papermc. I'm using my own plugin written in Kotlin to do the loading, but it failed on the 1.15.2 build. I got it to work on JDK 8 by doing this:

val engine = ScriptEngineManager(null).getEngineByName("nashorn")

Passing null to the ScriptManager fixed it. I got that from here: https://stackoverflow.com/a/25332851/1758461

jwulf commented 4 years ago

I'm now running on oracle/graalvm-ce:19.3.1-java8 and it's working for me.

ghost commented 4 years ago

jwulf ur an absolute legend u know that

TonyGravagno commented 4 years ago

The topic of Nashorn with JDK8 has been discussed in the Google Group. Graal might be the way to go at some point. @jwulf it would be nice to share notes with you about what you did there. I can add it into docs. Note from the linked forum post that Jonathan Perret provided some notes for anyone who is interested.

While Paper is a fork of Spigot (responding to "Dude, switch to CRAFTBUKKIT") to my knowledge ScriptCraft has never actually been tested with Paper enough to claim "support". So for anyone using Paper, please write up something (in a dedicated ticket which might lead to published documentation) about how and why.

About "ScriptCraft now requires the JDK (Java SE 13.0.2) to run as of Minecraft 1.15.2." - I don't think that's accurate. I just loaded 1.15.2 with 1.9 yesterday, haven't tested with SCJS yet. I hope we can get some concensus on details here.

jwulf commented 4 years ago

Magikcraft uses Scriptcraft with Paper 1.15.2 and GraalVM. Here is a working Docker image: https://hub.docker.com/r/magikcraft/scriptcraft. I've been running in production for years with it.

Mind you, with 1.15.2 Drones don't work - CraftEvil has been removed.

jrennie commented 2 years ago

I first tried using ScriptCraft (3.4.0 jar) with Paper ("no javascript engine available"). Then I tried spigot but go the same error. I'm using java 17 and a recent build of MC. I tried jwulf's patch to call ScriptEngineManager with a null arg.

I'm trying to build my own scriptcraft.jar. I'm currently stuck on ant gen-events-helper-bukkit which logs Cannot invoke "javax.script.ScriptEngine.put(String, Object)" because "<local2>" is null