SkriptLang / skript-reflect

Powerful reflection utilities for Skript.
MIT License
56 stars 19 forks source link

Can't run effect commands with custom syntax #72

Closed TheBentoBox closed 4 months ago

TheBentoBox commented 9 months ago

Describe the bug An internal error occurs when running an effect command with a skript-reflect custom syntax.

To reproduce

  1. Create any custom syntax.
  2. Try to use it in-game in an effect command using your configured effect command token in Skript.

Expected behavior The custom syntax is usable in game.

Screenshots

[10:56:16 ERROR]: #!#! 
[10:56:16 ERROR]: #!#! [Skript] Severe Error:
[10:56:16 ERROR]: #!#! Unexpected error while executing effect command 'run cultist raid' by 'Mr_Simba'
[10:56:16 ERROR]: #!#! 
[10:56:16 ERROR]: #!#! Something went horribly wrong with Skript.
[10:56:16 ERROR]: #!#! This issue is NOT your fault! You probably can't fix it yourself, either.
[10:56:16 ERROR]: #!#! It looks like you are using some plugin(s) that alter how Skript works (addons).
[10:56:16 ERROR]: #!#! Here is full list of them:
[10:56:16 ERROR]: #!#! skript-reflect v2.4-dev1 (https://github.com/TPGamesNL/skript-reflect) skript-gui v1.3 (https://github.com/APickledWalrus/skript-gui) skUtilities v0.9.2 (https://tim740.github.io/) SkBee v2.13.0 (https://github.com/ShaneBeee/SkBee)       
[10:56:16 ERROR]: #!#! We could not identify which of those are specially related, so this might also be Skript issue.
[10:56:16 ERROR]: #!#! You should try disabling those plugins one by one, trying to find which one causes it.
[10:56:16 ERROR]: #!#! If the error doesn't disappear even after disabling all listed plugins, it is probably Skript issue.
[10:56:16 ERROR]: #!#! In that case, you will be given instruction on how should you report it.
[10:56:16 ERROR]: #!#! On the other hand, if the error disappears when disabling some plugin, report it to author of that plugin.
[10:56:16 ERROR]: #!#! Only if the author tells you to do so, report it to Skript's issue tracker.
[10:56:16 ERROR]: #!#! 
[10:56:16 ERROR]: #!#! Stack trace:
[10:56:16 ERROR]: #!#! ch.njol.skript.SkriptAPIException: This ParserInstance is not currently parsing/loading something!
[10:56:16 ERROR]: #!#!     at Skript.jar//ch.njol.skript.lang.parser.ParserInstance.getCurrentScript(ParserInstance.java:129)
[10:56:16 ERROR]: #!#!     at skript-reflect-2.4-dev1.jar//com.btk5h.skriptmirror.util.SkriptUtil.getCurrentScriptFile(SkriptUtil.java:109)
[10:56:16 ERROR]: #!#!     at skript-reflect-2.4-dev1.jar//com.btk5h.skriptmirror.skript.custom.effect.CustomEffect.init(CustomEffect.java:71)
[10:56:16 ERROR]: #!#!     at Skript.jar//ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:266)
[10:56:16 ERROR]: #!#!     at Skript.jar//ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:176)
[10:56:16 ERROR]: #!#!     at Skript.jar//ch.njol.skript.lang.Effect.parse(Effect.java:76)
[10:56:16 ERROR]: #!#!     at Skript.jar//ch.njol.skript.command.Commands.handleEffectCommand(Commands.java:212)
[10:56:16 ERROR]: #!#!     at Skript.jar//ch.njol.skript.command.Commands$2$1.call(Commands.java:316)
[10:56:16 ERROR]: #!#!     at Skript.jar//ch.njol.skript.command.Commands$2$1.call(Commands.java:313)
[10:56:16 ERROR]: #!#!     at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftFuture.run(CraftFuture.java:88)
[10:56:16 ERROR]: #!#!     at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:480)
[10:56:16 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1507)
[10:56:16 ERROR]: #!#!     at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:487)
[10:56:16 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1421)
[10:56:16 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1192)
[10:56:16 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:323)
[10:56:16 ERROR]: #!#!     at java.base/java.lang.Thread.run(Thread.java:833)
[10:56:16 ERROR]: #!#! 
[10:56:16 ERROR]: #!#! Version Information:
[10:56:16 ERROR]: #!#!   Skript: 2.7.0-beta3 (latest)
[10:56:16 ERROR]: #!#!     Flavor: skriptlang-github
[10:56:16 ERROR]: #!#!     Date: 03:18:03.366646700
[10:56:16 ERROR]: #!#!   Bukkit: 1.20.1-R0.1-SNAPSHOT
[10:56:16 ERROR]: #!#!   Minecraft: 1.20.1
[10:56:16 ERROR]: #!#!   Java: 17.0.6 (Java HotSpot(TM) 64-Bit Server VM 17.0.6+9-LTS-190)
[10:56:16 ERROR]: #!#!   OS: Windows 11 amd64 10.0
[10:56:16 ERROR]: #!#! 
[10:56:16 ERROR]: #!#! Server platform: Paper
[10:56:16 ERROR]: #!#! 
[10:56:16 ERROR]: #!#! Current node: null
[10:56:16 ERROR]: #!#! Current item: null
[10:56:16 ERROR]: #!#! 
[10:56:16 ERROR]: #!#! Thread: Server thread
[10:56:16 ERROR]: #!#! 
[10:56:16 ERROR]: #!#! Language: english
[10:56:16 ERROR]: #!#! Link parse mode: LENIENT
[10:56:16 ERROR]: #!#! 
[10:56:16 ERROR]: #!#! End of Error.
[10:56:16 ERROR]: #!#! 

Server information

Pikachu920 commented 9 months ago

The issue is SkriptUtil#getCurrentScript checks for a null return rather than the SkriptAPIException that is actually thrown when there is no current script. Once that's updated, CustomImport#lookup might also need an update to check for a null script arg but I'm not sure if it's actually required as I think the current code would also work fine.