I stumbled apon an issue with having two comment symbols anywhere in the scripts.
Error:
[Server thread/ERROR]: #!#! java.lang.ClassCastException: ch.njol.skript.lang.Conditional$1 cannot be cast to ch.njol.skript.lang.Conditional
[Server thread/ERROR]: #!#! at ch.njol.skript.lang.Conditional.loadElseIf(Conditional.java:95)
[Server thread/ERROR]: #!#! at ch.njol.skript.lang.Conditional.loadElseIf(Conditional.java:95)
[Server thread/ERROR]: #!#! at ch.njol.skript.lang.Conditional.loadElseIf(Conditional.java:95)
[Server thread/ERROR]: #!#! at ch.njol.skript.lang.Conditional.loadElseIf(Conditional.java:95)
[Server thread/ERROR]: #!#! at ch.njol.skript.lang.Conditional.loadElseIf(Conditional.java:95)
[Server thread/ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadItems(ScriptLoader.java:1047)
[Server thread/ERROR]: #!#! at ch.njol.skript.command.Commands.loadCommand(Commands.java:496)
[Server thread/ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadScript(ScriptLoader.java:623)
[Server thread/ERROR]: #!#! at ch.njol.skript.ScriptLoader.lambda$1(ScriptLoader.java:391)
[Server thread/ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:403)
[Server thread/ERROR]: #!#! at ch.njol.skript.ScriptLoader.lambda$0(ScriptLoader.java:333)
[Server thread/ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:363)
[Server thread/ERROR]: #!#! at ch.njol.skript.Skript$2.run(Skript.java:472)
[Server thread/ERROR]: #!#! at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:76)
[Server thread/ERROR]: #!#! at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:361)
[Server thread/ERROR]: #!#! at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:739)
[Server thread/ERROR]: #!#! at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406)
[Server thread/ERROR]: #!#! at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679)
[Server thread/ERROR]: #!#! at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577)
[Server thread/ERROR]: #!#! at java.lang.Thread.run(Unknown Source)
[Server thread/ERROR]: #!#!
[Server thread/ERROR]: #!#! Version Information:
[Server thread/ERROR]: #!#! Skript: 2.2-dev37c
[Server thread/ERROR]: #!#! Bukkit: 1.12.2-R0.1-SNAPSHOT
[Server thread/ERROR]: #!#! Minecraft: 1.12.2
[Server thread/ERROR]: #!#! Java: 1.8.0_161 (Java HotSpot(TM) 64-Bit Server VM 25.161-b12)
[Server thread/ERROR]: #!#! OS: Windows 10 amd64 10.0
[Server thread/ERROR]: #!#! Server platform: Spigot
[Server thread/ERROR]: #!#!
[Server thread/ERROR]: #!#! Current node: else if player has dirt: (s.sk, line 145)
[Server thread/ERROR]: #!#! Current item: null
Script code:
on rightclick holding a firework rocket:
##cancel the event
##remove 1 of tool from tool
broadcast "firework"
I was working on some development stuff and I was like no way did whatever I just add break Skript, so I literally stripped everything down to Skript until I realized that I made a mistake writing the script, rip 馃挴
Been working with Java too much.
This should error telling the user they made a mistake. Currently Skript errors and every script breaks like flood gates.
I also had Pika's script loaded from the Scope API pull request. P.S This isn't related to what I posted about the errors during testing the Scope API in that pull request either.
Hmm, I don't really think the error is related to this code. This is very weird, according to the error Skript is trying to register an else if section to an else section, aka it seems like you have an else if after an else somewhere, but the weird part is that I can't reproduce this
on load:
if 0 is 1:
broadcast "hi"
else:
broadcast "hi"
else if 1 is 1:
broadcast "hi"
sk reload test
It correctly recognizes 'else if' has to be placed just after another 'if' or 'else if' section.
I've fixed the issue with two else sections recently and a corresponding treatment could be applied to else ifs, but hey, like I've shown above, it is supposed to work already... wtff
@TheLimeGlass and about your ##, Skript treats it as an escape, aka not a comment, but instead it tries to casually parse the #cancel the event as.. anything
Contributers need to test their shit. Like none of them actually test their code they implement. Please re-check what you added if this is something you added. This is the reason why I'm hard on pull requests and new commits.
I have no clue where or what is causing this. When was your thingy added so I can test the version before it.
More reason to setup test scripts like bensku and myself came up with.
@TheLimeGlass excuse me? It's not related to what I added at all
You said you recently fixed a similarity with else statements... Condition = else statement.
Yes, I've fixed a bug with multiple 'else' statements, but this one is about Skript trying to register an 'else if' to an 'else', it doesn't even touch the method that I've fixed
What version did you add it
Oh ya and if anyone uncomments that code and then right clicks a firework in their offhand, it causes a null pointer.
Please don't edit previous messages referring to me after I reply, completely changing the context lol.
It was added in dev37
The issue is that the erroring line of code is ((Conditional) elseClause).loadElseIf(cond, n);. elseClause is either a Conditional (an else if) or just a general TriggerSection (an else), created here:
https://github.com/SkriptLang/Skript/blob/94df3072da79d04a16c2b792f9c356caac762d00/src/main/java/ch/njol/skript/lang/Conditional.java#L76-L89
since it cannot be cast to a Conditional, according to the error - it must be an else statement, aka like I said
Skript trying to register an 'else if' to an 'else'
Ok my bad this time, must have misread something, sorry
What version was your fix added so I can test if it was the cause!
Latest? a, b, c?
a, b and c differ only in local variable type hint handing, aka everything else was added in the first dev37 (a or whatever it's called)