SkriptLang / skript-reflect

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

Cannot create custom expressions #100

Closed EquipableMC closed 2 months ago

EquipableMC commented 2 months ago

Describe the bug When you create a custom expression then reload the skript, skript cancels the reloading of the file and throws a huge error in console

To reproduce

  1. Create a skript file
  2. use the code listed below:
    expression glowing %item%:
    return type: item
    get:
        set {_item} to expr-1
        if {_item} is a fishing rod:
            enchant {_item} with infinity 1
        else:
            enchant {_item} with lure 1     
        return {_item} with hide enchants item flag
  3. reload the file

Expected behavior Its meant to give items the shiny/glowing effect.

Error

08:50:43 ERROR: #!#! [Skript] Severe Error: 08:50:43 ERROR: #!#! Exception occurred in Skript's main command 08:50:43 ERROR: #!#! Used command: /sk reload /main/api.sk

08:50:43 ERROR: #!#! Something went horribly wrong with Skript. 08:50:43 ERROR: #!#! This issue is NOT your fault! You probably can't fix it yourself, either. 08:50:43 ERROR: #!#! It looks like you are using some plugin(s) that alter how Skript works (addons). 08:50:43 ERROR: #!#! Here is full list of them: 08:50:43 ERROR: #!#! skript-placeholders v1.6.0 (https://github.com/APickledWalrus/skript-placeholders) skript-citizens v1.0.0 skript-reflect v2.4 (https://github.com/SkriptLang/skript-reflect) skript-gui v1.3 (https://github.com/APickledWalrus/skript-gui) DiSky v4.12.2-beta1 SkBee v3.4.1 (https://github.com/ShaneBeee/SkBee) SkLogs v1.1.1 (https://github.com/EquipableMC/SkLogs) 08:50:43 ERROR: #!#! We could not identify which of those are specially related, so this might also be Skript issue. 08:50:43 ERROR: #!#! You should try disabling those plugins one by one, trying to find which one causes it. 08:50:43 ERROR: #!#! If the error doesn't disappear even after disabling all listed plugins, it is probably Skript issue. 08:50:43 ERROR: #!#! In that case, you will be given instruction on how should you report it. 08:50:43 ERROR: #!#! On the other hand, if the error disappears when disabling some plugin, report it to author of that plugin. 08:50:43 ERROR: #!#! Only if the author tells you to do so, report it to Skript's issue tracker.

08:50:43 ERROR: #!#! Stack trace: 08:50:43 ERROR: #!#! java.lang.NullPointerException: Cannot invoke "java.util.Map.remove(Object)" because "syntaxes" is null 08:50:43 ERROR: #!#! at skript-reflect.jar//org.skriptlang.reflect.syntax.CustomSyntaxStructure.lambda$unload$1(CustomSyntaxStructure.java:158) 08:50:43 ERROR: #!#! at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) 08:50:43 ERROR: #!#! at skript-reflect.jar//org.skriptlang.reflect.syntax.CustomSyntaxStructure.unload(CustomSyntaxStructure.java:153) 08:50:43 ERROR: #!#! at Skript (5).jar//ch.njol.skript.ScriptLoader.unloadScripts(ScriptLoader.java:830) 08:50:43 ERROR: #!#! at Skript (5).jar//ch.njol.skript.ScriptLoader.unloadScript(ScriptLoader.java:864) 08:50:43 ERROR: #!#! at Skript (5).jar//ch.njol.skript.SkriptCommand.onCommand(SkriptCommand.java:189) 08:50:43 ERROR: #!#! at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) 08:50:43 ERROR: #!#! at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) 08:50:43 ERROR: #!#! at org.bukkit.craftbukkit.v1_19_R3.CraftServer.dispatchCommand(CraftServer.java:929) 08:50:43 ERROR: #!#! at org.bukkit.craftbukkit.v1_19R3.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) 08:50:43 ERROR: #!#! at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) 08:50:43 ERROR: #!#! at net.minecraft.commands.CommandDispatcher.performCommand(CommandDispatcher.java:322) 08:50:43 ERROR: #!#! at net.minecraft.commands.CommandDispatcher.a(CommandDispatcher.java:306) 08:50:43 ERROR: #!#! at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2297) 08:50:43 ERROR: #!#! at net.minecraft.server.network.PlayerConnection.lambda$handleChatCommand$20(PlayerConnection.java:2257) 08:50:43 ERROR: #!#! at net.minecraft.util.thread.IAsyncTaskHandler.b(IAsyncTaskHandler.java:59) 08:50:43 ERROR: #!#! at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) 08:50:43 ERROR: #!#! at net.minecraft.server.TickTask.run(TickTask.java:18) 08:50:43 ERROR: #!#! at net.minecraft.util.thread.IAsyncTaskHandler.d(IAsyncTaskHandler.java:153) 08:50:43 ERROR: #!#! at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(IAsyncTaskHandlerReentrant.java:24) 08:50:43 ERROR: #!#! at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1342) 08:50:43 ERROR: #!#! at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:197) 08:50:43 ERROR: #!#! at net.minecraft.util.thread.IAsyncTaskHandler.x(IAsyncTaskHandler.java:126) 08:50:43 ERROR: #!#! at net.minecraft.server.MinecraftServer.bi(MinecraftServer.java:1319) 08:50:43 ERROR: #!#! at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1312) 08:50:43 ERROR: #!#! at net.minecraft.util.thread.IAsyncTaskHandler.c(IAsyncTaskHandler.java:136) 08:50:43 ERROR: #!#! at net.minecraft.server.MinecraftServer.i(MinecraftServer.java:1290) 08:50:43 ERROR: #!#! at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1178) 08:50:43 ERROR: #!#! at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) 08:50:43 ERROR: #!#! at java.base/java.lang.Thread.run(Thread.java:840)

08:50:43 ERROR: #!#! Version Information: 08:50:43 ERROR: #!#! Skript: 2.8.3 (latest) 08:50:43 ERROR: #!#! Flavor: skriptlang-github 08:50:43 ERROR: #!#! Date: 16:23:04.254419600 08:50:43 ERROR: #!#! Bukkit: 1.19.4-R0.1-SNAPSHOT 08:50:43 ERROR: #!#! Minecraft: 1.19.4 08:50:43 ERROR: #!#! Java: 17.0.10 (OpenJDK 64-Bit Server VM 17.0.10+7) 08:50:43 ERROR: #!#! OS: Linux amd64 5.15.0-91-generic

08:50:43 ERROR: #!#! Server platform: Paper

08:50:43 ERROR: #!#! Current node: null 08:50:43 ERROR: #!#! Current item: null

08:50:43 ERROR: #!#! Thread: Server thread

08:50:43 ERROR: #!#! Language: english 08:50:43 ERROR: #!#! Link parse mode: DISABLED

08:50:43 ERROR: #!#! End of Error.

Server information

Additional context Skript info: [08:58:21 INFO]: [Skript] Skript's aliases can be found here: https://github.com/SkriptLang/skript-aliases [08:58:21 INFO]: [Skript] Skript's documentation can be found here: https://docs.skriptlang.org/ [08:58:21 INFO]: [Skript] Skript's tutorials can be found here: https://docs.skriptlang.org/tutorials [08:58:21 INFO]: [Skript] Server Version: git-Paper-550 (MC: 1.19.4) [08:58:21 INFO]: [Skript] Skript Version: 2.8.3 (skriptlang-github) [08:58:21 INFO]: [Skript] Installed Skript Addons: [08:58:21 INFO]: [Skript] - skript-placeholders v1.6.0 (https://github.com/APickledWalrus/skript-placeholders) [08:58:21 INFO]: [Skript] - skript-gui v1.3 (https://github.com/APickledWalrus/skript-gui) [08:58:21 INFO]: [Skript] - DiSky v4.12.2-beta1 [08:58:21 INFO]: [Skript] - skript-reflect v2.4 (https://github.com/SkriptLang/skript-reflect) [08:58:21 INFO]: [Skript] - skript-citizens v1.0.0 [08:58:21 INFO]: [Skript] - SkBee v3.4.1 (https://github.com/ShaneBeee/SkBee) [08:58:21 INFO]: [Skript] - SkLogs v1.1.1 (https://github.com/EquipableMC/SkLogs) [08:58:21 INFO]: [Skript] Installed dependencies: [08:58:21 INFO]: [Skript] - Vault v1.7.3-b131

EquipableMC commented 2 months ago

I was wondering if there is a nightly build I can use that fixes this until a new version is released?

AyhamAl-Ali commented 2 months ago

Are you sure it's not a duplicate of #86? I assume it may be a duplicate of an addon's expression. Try to change glowing to gloowing and see if it works.

EquipableMC commented 2 months ago

Are you sure it's not a duplicate of #86? I assume it may be a duplicate of an addon's expression. Try to change glowing to gloowing and see if it works.

No addons have glowing that I have installed. Skbee I know doesn't have it, skript-citizens is a self build of nylhus's skript-citizens addon plugin (it's modified to support 1.19+)

AyhamAl-Ali commented 2 months ago

Are you sure it's not a duplicate of #86? I assume it may be a duplicate of an addon's expression. Try to change glowing to gloowing and see if it works.

No addons have glowing that I have installed. Skbee I know doesn't have it, skript-citizens is a self build of nylhus's skript-citizens addon plugin (it's modified to support 1.19+)

Still try to change glowing to something unique. Maybe one of your other scripts have the same custom expression?

EquipableMC commented 2 months ago

Are you sure it's not a duplicate of #86? I assume it may be a duplicate of an addon's expression. Try to change glowing to gloowing and see if it works.

No addons have glowing that I have installed. Skbee I know doesn't have it, skript-citizens is a self build of nylhus's skript-citizens addon plugin (it's modified to support 1.19+)

Still try to change glowing to something unique. Maybe one of your other scripts have the same custom expression?

None of them do, I only have 3 skript files. One for a scoreboard, one for my discord bot, and one for functions and custom expressions (where that glowing expression is located at)

EquipableMC commented 2 months ago

I'll still try glooowing right now though ^^

EquipableMC commented 2 months ago

weird, it no longer errors, It let me do glowing now, strange

Pikachu920 commented 2 months ago

it happens when you have the same custom syntax declared more than once (even in another script). If you can reproduce the error without that, please leave a comment with the scripts to reproduce