TriggerReactor

TriggerReactor

24.6k Downloads

Executor works with run but not in a Named trigger.

soliddanii opened this issue · 7 comments

commented

I'm having a really weird problem. If I write /trg run #WORLD:LEVEROFF -14341,82,-1716 everything works fine. If I execute the exact same command but in a named trigger I get an error like if the location wasn't the same, and there was no lever there (but you can see in the error the numbers are the same).

Named Trigger:

#WORLD:LEVEROFF -14341,82,-1716
#WORLD:ITEMFRAMEROTATE "FLIPPED" -14343,82,-1716
#WORLD:ITEMFRAMEROTATE "CLOCKWISE_135" -14339,82,-1716
#WORLD:ITEMFRAMEROTATE "CLOCKWISE_135" -14337,82,-1717
#WORLD:ITEMFRAMEROTATE "CLOCKWISE_135" -14337,82,-1723
#MESSAGE Sala 01 Reiniciada

Error:

... 17 more
io.github.wysohn.triggerreactor.core.script.interpreter.InterpreterException: Error occured while processing Node [type: COMMAND, value: 'WORLD:LEVEROFF'] {([type: INTEGER, value: '-14341']) ([type: INTEGER, value: '82']) ([type: INTEGER, value: '-1716']) }
at io.github.wysohn.triggerreactor.core.script.interpreter.Interpreter.interpret(Interpreter.java:597)
at io.github.wysohn.triggerreactor.core.script.interpreter.Interpreter.start(Interpreter.java:266)
at io.github.wysohn.triggerreactor.core.script.interpreter.Interpreter.startWithContextAndInterrupter(Interpreter.java:140)
at io.github.wysohn.triggerreactor.core.manager.trigger.AbstractTriggerManager$Trigger.start(AbstractTriggerManager.java:185)
at io.github.wysohn.triggerreactor.core.manager.trigger.AbstractTriggerManager$Trigger.startInterpretation(AbstractTriggerManager.java:165)
at io.github.wysohn.triggerreactor.core.manager.trigger.AbstractTriggerManager$Trigger.activate(AbstractTriggerManager.java:115)
at io.github.wysohn.triggerreactor.bukkit.main.JavaPluginBridge$1.onCommand(JavaPluginBridge.java:256)
at io.github.wysohn.triggerreactor.core.script.interpreter.Interpreter.interpret(Interpreter.java:320)
at io.github.wysohn.triggerreactor.core.script.interpreter.Interpreter.start(Interpreter.java:266)
at io.github.wysohn.triggerreactor.core.script.interpreter.Interpreter.startWithContextAndInterrupter(Interpreter.java:140)
at io.github.wysohn.triggerreactor.core.manager.trigger.AbstractTriggerManager$Trigger.start(AbstractTriggerManager.java:185)
at io.github.wysohn.triggerreactor.core.manager.trigger.AbstractTriggerManager$Trigger$1.run(AbstractTriggerManager.java:170)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.Exception: #LEVEROFF encountered error.
at io.github.wysohn.triggerreactor.bukkit.manager.ExecutorManager$JSExecutor.execute(ExecutorManager.java:297)
at io.github.wysohn.triggerreactor.core.script.interpreter.Interpreter.interpret(Interpreter.java:326)
... 12 more
Caused by: javax.script.ScriptException: Error: Invalid lever. That block is not a valid lever! in at line number 38 at column number 3
at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:470)
at jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:392)
at jdk.nashorn.api.scripting.NashornScriptEngine.invokeFunction(NashornScriptEngine.java:190)
at io.github.wysohn.triggerreactor.bukkit.manager.ExecutorManager$JSExecutor$1.call(ExecutorManager.java:286)
at io.github.wysohn.triggerreactor.bukkit.manager.ExecutorManager$JSExecutor$1.call(ExecutorManager.java:273)
at io.github.wysohn.triggerreactor.bukkit.manager.ExecutorManager$JSExecutor.execute(ExecutorManager.java:294)
... 13 more
Caused by: :38:3 Error: Invalid lever. That block is not a valid lever!
at jdk.nashorn.internal.objects.NativeError.initException(NativeError.java:137)
at jdk.nashorn.internal.objects.NativeError.(NativeError.java:102)
at jdk.nashorn.internal.objects.NativeError.(NativeError.java:106)
at jdk.nashorn.internal.objects.NativeError.(NativeError.java:110)
at jdk.nashorn.internal.objects.NativeError.constructor(NativeError.java:129)
at jdk.nashorn.internal.scripts.Script$Recompilation$183$914A$\^eval\_.LEVEROFF(:38)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:639)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
at jdk.nashorn.api.scripting.ScriptObjectMirror.callMember(ScriptObjectMirror.java:199)
at jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:386)
... 17 more

Using build 156.
Thank you.

Edit:
Tryied build 166 and getting an internal error every time I try to run any named or temporal triggers.

org.bukkit.command.CommandException: Unhandled exception executing command 'trg' in plugin TriggerReactor v1.1.3
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[patched_1.12.jar:git-Paper-1133]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:151) ~[patched_1.12.jar:git-Paper-1133]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchCommand(CraftServer.java:669) ~[patched_1.12.jar:git-Paper-1133]
at net.minecraft.server.v1_12_R1.PlayerConnection.handleCommand(PlayerConnection.java:1424) ~[patched_1.12.jar:git-Paper-1133]
at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1229) ~[patched_1.12.jar:git-Paper-1133]
at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:45) ~[patched_1.12.jar:git-Paper-1133]
at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:5) ~[patched_1.12.jar:git-Paper-1133]
at net.minecraft.server.v1_12_R1.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:14) ~[patched_1.12.jar:git-Paper-1133]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_131]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_131]
at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) [patched_1.12.jar:git-Paper-1133]
at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:842) [patched_1.12.jar:git-Paper-1133]
at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:423) [patched_1.12.jar:git-Paper-1133]
at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:766) [patched_1.12.jar:git-Paper-1133]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:664) [patched_1.12.jar:git-Paper-1133]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]
Caused by: java.lang.NullPointerException
at io.github.wysohn.triggerreactor.tools.ReflectionUtil.extractVariablesWithEnumAsString(ReflectionUtil.java:183) ~[TriggerReactor.jar:?]
at io.github.wysohn.triggerreactor.core.manager.trigger.AbstractTriggerManager$Trigger.activate(AbstractTriggerManager.java:138) ~[TriggerReactor.jar:?]
at io.github.wysohn.triggerreactor.core.main.TriggerReactor.onCommand(TriggerReactor.java:310) ~[TriggerReactor.jar:?]
at io.github.wysohn.triggerreactor.bukkit.main.TriggerReactor.onCommand(TriggerReactor.java:71) ~[TriggerReactor.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[patched_1.12.jar:git-Paper-1133]
... 15 more
commented

You can stick with the build on the bukkit site as the Sponge implementation is not stable for now

Yet, I do recommend to use dev version for the sake of finding more bugs :)

Anyway, I will look into it.


I see that the error says "Invalid lever. That block is not a valid lever!"

can you confirm it's true or not?

Like a little modification in the Executor to see what value was passed to the Executor.

This information will be really helpful

commented

build 166 issue is fixed: 790403f

commented

Tested latest version:

Confirmed executors working in Named Triggers. Report again if you find them happens in the latest version!

commented

Using latest build 172.
Like with 156, the LEVEROFF (and other block changing executors) doesn't work when fired from a named trigger. I can 100% confirm there is a lever there, I have discovered the error is other.
The code inside the try gets to the end and fails in the last statement, the BlockState.update(true);

Code inside try-catch

Block = location.getBlock();
BlockState = Block.getState();
Lever = BlockState.getData();

Lever.setPowered(false);
BlockState.setData(Lever);
BlockState.update(true); --> Fails in this sentence

If I print the error message, this is what I get:

Asynchronous Async Player Chunk Add!

It looks like the plugin is trying to change the world asynchronously and obviously bukkit api dones't allow that. It's weird this happens in a named trigger but dones't in a temp trigger.

commented

I see the issue now; great catch again!

Recently, another user found similar bug in Repeating Trigger, and it was sync/async problem.

This must be the same problem too.

commented

Fixed in c0774aa

Tested case:

  • Named Trigger: SyncTest

    #WORLD:LEVERTOGGLE x y z
    #MESSAGE "Sala 01 Reiniciada"

  • Temp Trigger: /trg run x=12;y=72;z=346;#CALL "SyncTest"

  • Repeating Trigger:

    x=12
    y=72
    z=346
    #CALL "SyncTest"

commented

Works as expected now :)