ForgeEssentials

ForgeEssentials

339k Downloads

CNPCs mod Scripting problem

sklll opened this issue ยท 6 comments

commented

I have a problem: when I try to run scripts with CNPCs mod (Custom NPCs by Noppes)
It works ok most of the time, but when I try to do Forge event scripts like this:

var API = Java.type("noppes.npcs.api.NpcAPI").Instance()
function worldOut(message) {
API.getIWorld(0).broadcast(message)
}

It gives an error (See server-error.txt below)
Without FE everything works fine.
Checked on forgeessentials-1.12.2-12.3.30-server and on forgeessentials-1.12.2-12.3.41-server
forge-1.12.2-14.23.5.2796

To reproduce:

  1. Enable scripting with CNPCs (nashorn.jar should be in mods folder for JS)
  2. Run MC and right-click with a scripter tool in the air
  3. Pick "Forge"
  4. Make sure Enabled=YES https://www.dropbox.com/s/mbd5tf4igzzwqwh/%D0%A1%D0%BA%D1%80%D0%B8%D0%BD%D1%88%D0%BE%D1%82%202019-02-01%2003.37.44.png?dl=0
  5. Add and navigate to tab 1
  6. Copy-paste the script to tab1
  7. Press Esc

Expected: no errors displayed
Actual: "ForgeScript script errored" message displayed

its saying Java.type does not exist for some reason (
feperm debug gives nothing: https://www.dropbox.com/s/mpzak2a7bc1b7kr/%D0%A1%D0%BA%D1%80%D0%B8%D0%BD%D1%88%D0%BE%D1%82%202019-02-01%2002.49.43.png?dl=0
here are latest logs:

Server-CustomNPCs-latest.log
Server-debug.log
Server-latest.log
Server-error.txt
modlist.txt

commented

Full version of the script - one part should be in Forge and other in Player scripts:
c_forge_mounts.txt

commented

Is reproduced on different versions of CNPCs - on each I've checked including:
CustomNPCs_1.12.223Jan19snapshot2
CustomNPCs_1.12.2(30Jan19)

commented

I believe these are relevant client logs:
2019-02-01-1.log.gz
debug-4.log.gz

commented

Minimal version of the script is
log(Java);
produces this:
javaError.txt

Logs:
Server-logs.zip
Client-logs.zip

commented

Confirmed - it works properly now.
tested on #42 and #44
Thank you!

commented

@sklll This should be fixed in build 42. Please confirm.