Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default Variables Exception #6013

Closed
1 task done
arnigel2000 opened this issue Sep 16, 2023 · 9 comments
Closed
1 task done

Default Variables Exception #6013

arnigel2000 opened this issue Sep 16, 2023 · 9 comments
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. investigating The core developers are currently investigating this issue. Usually used for complex cases. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation). variables Related to variables and/or storing them. waiting for reply The report needs a response from the reporter to determine course of action.

Comments

@arnigel2000
Copy link

arnigel2000 commented Sep 16, 2023

Skript/Server Version

sk info

[13:42:23 INFO]: [Skript] Skript's aliases can be found here: https://github.com/SkriptLang/skript-aliases
[13:42:23 INFO]: [Skript] Skript's documentation can be found here: https://docs.skriptlang.org/
[13:42:23 INFO]: [Skript] Skript's tutorials can be found here: https://docs.skriptlang.org/tutorials
[13:42:23 INFO]: [Skript] Server Version: git-Paper-550 (MC: 1.19.4)
[13:42:23 INFO]: [Skript] Skript Version: 2.7.0 (skriptlang-github)
[13:42:23 INFO]: [Skript] Installed Skript Addons: None
[13:42:23 INFO]: [Skript] Installed dependencies:
[13:42:23 INFO]: [Skript] - Vault v1.7.3-b131
[13:42:23 INFO]: [Skript] - WorldGuard v7.0.8+33cdb4a

Bug Description

I recently updated my version of skript from 2.7.0b to 2.7.0, with the new version every time I run any command to reload the scripts I get this error. Under these conditions I cannot continue to work efficiently on my project, my server runs on paper, and the version is 1.19.4:

Expected Behavior

it should reload the script

Steps to Reproduce

there must be a problem with my script, that's what gives me this error, because I tried to reload a test script and it works. But recently I haven't added any particular functions to the one that gives errors.

However, to replicate it to me, just type /sk reload (file name)

Errors or Screenshots

[13:27:03 INFO]: [Skript] Reloading the config, aliases and all scripts...

[13:27:11 INFO]: Loaded 150508 aliases in 7702ms

[13:27:11 ERROR]: #!#!

[13:27:11 ERROR]: #!#! [Skript] Severe Error:

[13:27:11 ERROR]: #!#! Exception occurred in Skript's main command

[13:27:11 ERROR]: #!#! Used command: /sk reload all

[13:27:11 ERROR]: #!#!

[13:27:11 ERROR]: #!#! Something went horribly wrong with Skript.

[13:27:11 ERROR]: #!#! This issue is NOT your fault! You probably can't fix it yourself, either.

[13:27:11 ERROR]: #!#! You should report it at https://github.com/SkriptLang/Skript/issues. Please copy paste this report there (or use paste service).

[13:27:11 ERROR]: #!#! This ensures that your issue is noticed and will be fixed as soon as possible.

[13:27:11 ERROR]: #!#!

[13:27:11 ERROR]: #!#! Stack trace:

[13:27:11 ERROR]: #!#! java.lang.NullPointerException: Cannot invoke "ch.njol.skript.structures.StructVariables$DefaultVariables.getVariables()" because "data" is null

[13:27:11 ERROR]: #!#! at Skript.jar//ch.njol.skript.structures.StructVariables.postUnload(StructVariables.java:251)

[13:27:11 ERROR]: #!#! at Skript.jar//ch.njol.skript.ScriptLoader.unloadScripts(ScriptLoader.java:845)

[13:27:11 ERROR]: #!#! at Skript.jar//ch.njol.skript.SkriptCommand.onCommand(SkriptCommand.java:140)

[13:27:11 ERROR]: #!#! at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45)

[13:27:11 ERROR]: #!#! at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155)

[13:27:11 ERROR]: #!#! at org.bukkit.craftbukkit.v1_19_R3.CraftServer.dispatchCommand(CraftServer.java:929)

[13:27:11 ERROR]: #!#! at org.bukkit.craftbukkit.v1_19_R3.CraftServer.dispatchServerCommand(CraftServer.java:892)

[13:27:11 ERROR]: #!#! at net.minecraft.server.dedicated.DedicatedServer.bh(DedicatedServer.java:501)

[13:27:11 ERROR]: #!#! at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:448)

[13:27:11 ERROR]: #!#! at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1397)

[13:27:11 ERROR]: #!#! at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1174)

[13:27:11 ERROR]: #!#! at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320)

[13:27:11 ERROR]: #!#! at java.base/java.lang.Thread.run(Thread.java:833)

[13:27:11 ERROR]: #!#!

[13:27:11 ERROR]: #!#! Version Information:

[13:27:11 ERROR]: #!#! Skript: 2.7.0 (latest)

[13:27:11 ERROR]: #!#! Flavor: skriptlang-github

[13:27:11 ERROR]: #!#! Date: 08:55:03.744299

[13:27:11 ERROR]: #!#! Bukkit: 1.19.4-R0.1-SNAPSHOT

[13:27:11 ERROR]: #!#! Minecraft: 1.19.4

[13:27:11 ERROR]: #!#! Java: 17.0.7 (Java HotSpot(TM) 64-Bit Server VM 17.0.7+8-LTS-jvmci-23.0-b12)

[13:27:11 ERROR]: #!#! OS: Linux amd64 6.0.0-060000-generic

[13:27:11 ERROR]: #!#!

[13:27:11 ERROR]: #!#! Server platform: Paper

[13:27:11 ERROR]: #!#!

[13:27:11 ERROR]: #!#! Current node: null

[13:27:11 ERROR]: #!#! Current item: null

[13:27:11 ERROR]: #!#!

[13:27:11 ERROR]: #!#! Thread: Server thread

[13:27:11 ERROR]: #!#!

[13:27:11 ERROR]: #!#! Language: english

[13:27:11 ERROR]: #!#! Link parse mode: DISABLED

[13:27:11 ERROR]: #!#!

[13:27:11 ERROR]: #!#! End of Error.

[13:27:11 ERROR]: #!#! 

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this report.
@AyhamAl-Ali
Copy link
Member

Duplicate of #5850. Possible related #5967.

@AyhamAl-Ali AyhamAl-Ali added the duplicate For bugs or requests that have already been made and are currently open. label Sep 16, 2023
@AyhamAl-Ali
Copy link
Member

Reopening since first issue submitter has gone vanished.
Can you send your code where you use variables: section?

@AyhamAl-Ali AyhamAl-Ali reopened this Sep 16, 2023
@Moderocky
Copy link
Member

Moderocky commented Sep 16, 2023

Thanks for finding this, it looks like both here:
image
and here:
image
the data is assumed to be present, whereas in fact the method used has a nullable result
image

Either we need to work out why the value isn't present (when it seems like it ought to be) or as a safety alternative we could either use the default supplier or check if the value is null and do something about that.

In both cases we probably ought to have some kind of null check here.

@Moderocky Moderocky added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. investigating The core developers are currently investigating this issue. Usually used for complex cases. waiting for reply The report needs a response from the reporter to determine course of action. variables Related to variables and/or storing them. and removed duplicate For bugs or requests that have already been made and are currently open. labels Sep 16, 2023
@AyhamAl-Ali AyhamAl-Ali added priority: low Issues that are not harmful to the experience but are related to useful changes or additions. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation). and removed priority: low Issues that are not harmful to the experience but are related to useful changes or additions. labels Sep 16, 2023
@arnigel2000
Copy link
Author

arnigel2000 commented Sep 16, 2023

perhaps this is where the problem might be

on place:
    if "%region at event-block%" contains "hacking in world pixelnovia":
        if event-block is Redstone Comparator:   
            set {_amount} to placeholder "playerlist_donors_amount" parsed as integer 
            if {_amount} < 1:
                send "&cnon ci sono abbastanza poliziotti online" to player
                cancel event
            else:
                send "&aHacking iniziato...30 secondi all'apertura del cavò!" to player

or here

variables:
    {haraccolto.droga} = false

command /raccogli droga:
    trigger:
        if {_amount} < 1: 
            send "&4non ci sono abbastanza poliziotti online!" to player
        else:
            if player is in region ("serra1"):
                if {haraccolto.droga} = false:
                    set {haraccolto.droga} to true    
                    send "&ahai iniziato a raccogliere..." to player
                    wait 5 seconds
                    if player is in region ("serra1"):
                        wait 5 seconds
                        if player is in region ("serra1"):
                            wait 5 seconds
                            if player is in region ("serra1"):
                                wait 5 seconds
                                if player is in region ("serra1"):
                                    wait 5 seconds
                                    if player is in region ("serra1"):   
                                        wait 5 seconds
                                        if player is in region ("serra1"):
                                            give stone to player
                                            set {haraccolto.droga} to false
                                        else:
                                            send "&4ti sei allontanato troppo,raccolta annullata :\" to player
                                            set {haraccolto.droga} to false
                                    else:
                                        send "&4ti sei allontanato troppo,raccolta annullata :\" to player                                                           
                                        set {haraccolto.droga} to false
                                else:
                                    send "&4ti sei allontanato troppo,raccolta annullata :\" to player
                                    set {haraccolto.droga} to false
                            else:
                                send "&4ti sei allontanato troppo,raccolta annullata :\" to player
                                set {haraccolto.droga} to false
                        else:
                            send "&4ti sei allontanato troppo,raccolta annullata :\" to player
                            set {haraccolto.droga} to false
                    else:
                        send "&4ti sei allontanato troppo,raccolta annullata :\" to player             
                        set {haraccolto.droga} to false
                else:
                    send "&astai già raccogliendo" to player 
                    set {haraccolto.droga} to false
            else:
                send "&4non puoi raccogliere nulla qui, non è il posto giusto..." to player

@AyhamAl-Ali AyhamAl-Ali changed the title Very serious problem Default Variables Exception Sep 16, 2023
@arnigel2000
Copy link
Author

How is the resolution of the problem going? At the moment I can't work with variables on script, which is a big problem for me, and moreover to restart the script I have to restart the whole server. I don't want to be rude but I think that if the problem is not resolved I will be forced to put the previous version of script, hoping that everything goes well there.

@Moderocky
Copy link
Member

I have been unable to reproduce this error so far.
If somebody else can then we may be able to fix it in time for the next release in 11 days.

Can you provide the code that is causing this error?

@APickledWalrus
Copy link
Member

@arnigel2000 Can you confirm whether you have two variables: structures in the offending script? Using two at once in the same script may cause this error.

@arnigel2000
Copy link
Author

The 2 variables are in the same script, but it's strange because until now it worked, anyway I'll try to put them in two different scripts. However, the variable I use in the first and second cases "{_amount}" is a placeholder that I got from a plugin named "Playerlists". Maybe that caused problems.

@arnigel2000
Copy link
Author

thanks to your advice skript started working again, probably the problem was the two variables within the same script, thanks for the support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. investigating The core developers are currently investigating this issue. Usually used for complex cases. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation). variables Related to variables and/or storing them. waiting for reply The report needs a response from the reporter to determine course of action.
Projects
None yet
Development

No branches or pull requests

4 participants