ScriptCraft

ScriptCraft

14.6k Downloads

greet is not defined

maple3142 opened this issue ยท 3 comments

commented

I have a greet.js in plugins\scriptcraft\plugins
greet.js:

exports.greet = function( player ) {
    echo( player, 'Hi ' + player.name);
}

then I type /js refresh() and /js greef(self)
but It said greet is not defined

commented

In your example you tried to call "greef". Was that a typo in your bug report or in your test?

commented

logs/latest.log:

[00:00:34] [Server thread/ERROR]: [scriptcraft] Error while trying to evaluate javascript: greet(self), Error: javax.script.ScriptException: ReferenceError: "greet" is not defined in <eval> at line number 1
[00:00:34] [Server thread/ERROR]: [scriptcraft] javax.script.ScriptException: javax.script.ScriptException: ReferenceError: "greet" is not defined in <eval> at line number 1 in <eval> at line number 638 at column number 8
[00:00:34] [Server thread/WARN]: javax.script.ScriptException: javax.script.ScriptException: ReferenceError: "greet" is not defined in <eval> at line number 1 in <eval> at line number 638 at column number 8
[00:00:34] [Server thread/WARN]: 	at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:470)
[00:00:34] [Server thread/WARN]: 	at jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:392)
[00:00:34] [Server thread/WARN]: 	at jdk.nashorn.api.scripting.NashornScriptEngine.invokeFunction(NashornScriptEngine.java:190)
[00:00:34] [Server thread/WARN]: 	at org.scriptcraftjs.bukkit.ScriptCraftPlugin.onCommand(ScriptCraftPlugin.java:76)
[00:00:34] [Server thread/WARN]: 	at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
[00:00:34] [Server thread/WARN]: 	at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141)
[00:00:34] [Server thread/WARN]: 	at org.bukkit.craftbukkit.v1_10_R1.CraftServer.dispatchCommand(CraftServer.java:647)
[00:00:34] [Server thread/WARN]: 	at net.minecraft.server.v1_10_R1.PlayerConnection.handleCommand(PlayerConnection.java:1358)
[00:00:34] [Server thread/WARN]: 	at net.minecraft.server.v1_10_R1.PlayerConnection.a(PlayerConnection.java:1193)
[00:00:34] [Server thread/WARN]: 	at net.minecraft.server.v1_10_R1.PacketPlayInChat.a(PacketPlayInChat.java:45)
[00:00:34] [Server thread/WARN]: 	at net.minecraft.server.v1_10_R1.PacketPlayInChat.a(PacketPlayInChat.java:1)
[00:00:34] [Server thread/WARN]: 	at net.minecraft.server.v1_10_R1.PlayerConnectionUtils$1.run(SourceFile:13)
[00:00:34] [Server thread/WARN]: 	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[00:00:34] [Server thread/WARN]: 	at java.util.concurrent.FutureTask.run(Unknown Source)
[00:00:34] [Server thread/WARN]: 	at net.minecraft.server.v1_10_R1.SystemUtils.a(SourceFile:45)
[00:00:34] [Server thread/WARN]: 	at net.minecraft.server.v1_10_R1.MinecraftServer.D(MinecraftServer.java:732)
[00:00:34] [Server thread/WARN]: 	at net.minecraft.server.v1_10_R1.DedicatedServer.D(DedicatedServer.java:400)
[00:00:34] [Server thread/WARN]: 	at net.minecraft.server.v1_10_R1.MinecraftServer.C(MinecraftServer.java:668)
[00:00:34] [Server thread/WARN]: 	at net.minecraft.server.v1_10_R1.MinecraftServer.run(MinecraftServer.java:567)
[00:00:34] [Server thread/WARN]: 	at java.lang.Thread.run(Unknown Source)

this issue can be closed, because I wrong put .js files in server/plugins/scriptcraft/plugins

commented

Closing per request.