SkriptLang / Skript

Skript is a Spigot plugin which allows server admins to customize their server easily, but without the hassle of programming a plugin or asking/paying someone to program a plugin for them.
https://docs.skriptlang.org
GNU General Public License v3.0
1.03k stars 361 forks source link

NotSerializableException: ch.njol.skript.util.visual.VisualEffectType #5557

Closed potatoeded closed 1 year ago

potatoeded commented 1 year ago

Skript/Server Version

[11:55:36 INFO]: [Skript] Skript's aliases can be found here: https://github.com/SkriptLang/skript-aliases
[11:55:36 INFO]: [Skript] Skript's documentation can be found here: https://docs.skriptlang.org/
[11:55:36 INFO]: [Skript] Skript's tutorials can be found here: https://docs.skriptlang.org/tutorials
[11:55:36 INFO]: [Skript] Server Version: git-Paper-307 (MC: 1.19.2)
[11:55:36 INFO]: [Skript] Skript Version: 2.7.0-beta2 (skriptlang-github)
[11:55:36 INFO]: [Skript] Installed Skript Addons: None
[11:55:36 INFO]: [Skript] Installed dependencies: None

Bug Description

Error with Skript when reloading.

Expected Behavior

The Skript works normally except for the error.

Steps to Reproduce

I'm unsure of how you could reproduce this error.

Errors or Screenshots

11:50:55 ERROR: #!#! [Skript] Severe Error:

11:50:55 ERROR: #!#! Something went horribly wrong with Skript. 11:50:55 ERROR: #!#! This issue is NOT your fault! You probably can't fix it yourself, either. 11:50:55 ERROR: #!#! You should report it at https://github.com/SkriptLang/Skript/issues. Please copy paste this report there (or use paste service). 11:50:55 ERROR: #!#! This ensures that your issue is noticed and will be fixed as soon as possible.

11:50:55 ERROR: #!#! Stack trace: 11:50:55 ERROR: #!#! java.io.NotSerializableException: ch.njol.skript.util.visual.VisualEffectType 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.yggdrasil.YggdrasilOutputStream.writeGenericObject(YggdrasilOutputStream.java:174) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.yggdrasil.YggdrasilOutputStream.writeObject(YggdrasilOutputStream.java:249) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.yggdrasil.YggdrasilOutputStream.writeGenericObject(YggdrasilOutputStream.java:199) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.yggdrasil.YggdrasilOutputStream.writeObject(YggdrasilOutputStream.java:249) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.skript.registrations.Classes.serialize(Classes.java:748) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.skript.variables.Variables.serialize(Variables.java:775) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.skript.variables.Variables.serialize(Variables.java:756) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.skript.variables.Variables.saveVariableChange(Variables.java:785) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.skript.variables.Variables.setVariable(Variables.java:506) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.skript.variables.Variables.setVariable(Variables.java:489) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.skript.lang.Variable.setIndex(Variable.java:504) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.skript.lang.Variable.change(Variable.java:620) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.skript.effects.EffChange.execute(EffChange.java:280) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.skript.lang.Effect.run(Effect.java:50) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:62) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:90) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.skript.lang.Trigger.execute(Trigger.java:52) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.skript.events.EvtScript.runTrigger(EvtScript.java:88) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.skript.events.EvtScript.postLoad(EvtScript.java:61) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.skript.ScriptLoader.lambda$loadScripts$9(ScriptLoader.java:572) 11:50:55 ERROR: #!#! at java.base/java.util.ArrayList.removeIf(ArrayList.java:1672) 11:50:55 ERROR: #!#! at java.base/java.util.ArrayList.removeIf(ArrayList.java:1660) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.skript.ScriptLoader.lambda$loadScripts$10(ScriptLoader.java:568) 11:50:55 ERROR: #!#! at java.base/java.util.concurrent.CompletableFuture.uniApplyNow(CompletableFuture.java:684) 11:50:55 ERROR: #!#! at java.base/java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:662) 11:50:55 ERROR: #!#! at java.base/java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:2168) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:511) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:457) 11:50:55 ERROR: #!#! at Skript-2.7.0-beta2.jar//ch.njol.skript.SkriptCommand.onCommand(SkriptCommand.java:153) 11:50:55 ERROR: #!#! at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) 11:50:55 ERROR: #!#! at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) 11:50:55 ERROR: #!#! at org.bukkit.craftbukkit.v1_19_R1.CraftServer.dispatchCommand(CraftServer.java:916) 11:50:55 ERROR: #!#! at org.bukkit.craftbukkit.v1_19_R1.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) 11:50:55 ERROR: #!#! at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) 11:50:55 ERROR: #!#! at net.minecraft.commands.CommandDispatcher.performCommand(CommandDispatcher.java:305) 11:50:55 ERROR: #!#! at net.minecraft.commands.CommandDispatcher.a(CommandDispatcher.java:289) 11:50:55 ERROR: #!#! at net.minecraft.server.network.PlayerConnection.b(PlayerConnection.java:2294) 11:50:55 ERROR: #!#! at net.minecraft.server.network.PlayerConnection.lambda$handleChatCommand$20(PlayerConnection.java:2248) 11:50:55 ERROR: #!#! at net.minecraft.util.thread.IAsyncTaskHandler.b(IAsyncTaskHandler.java:59) 11:50:55 ERROR: #!#! at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) 11:50:55 ERROR: #!#! at net.minecraft.server.TickTask.run(TickTask.java:18) 11:50:55 ERROR: #!#! at net.minecraft.util.thread.IAsyncTaskHandler.d(IAsyncTaskHandler.java:153) 11:50:55 ERROR: #!#! at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(IAsyncTaskHandlerReentrant.java:24) 11:50:55 ERROR: #!#! at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1341) 11:50:55 ERROR: #!#! at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:185) 11:50:55 ERROR: #!#! at net.minecraft.util.thread.IAsyncTaskHandler.x(IAsyncTaskHandler.java:126) 11:50:55 ERROR: #!#! at net.minecraft.server.MinecraftServer.bh(MinecraftServer.java:1318) 11:50:55 ERROR: #!#! at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1311) 11:50:55 ERROR: #!#! at net.minecraft.util.thread.IAsyncTaskHandler.c(IAsyncTaskHandler.java:136) 11:50:55 ERROR: #!#! at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1289) 11:50:55 ERROR: #!#! at net.minecraft.server.MinecraftServer.v(MinecraftServer.java:1177) 11:50:55 ERROR: #!#! at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) 11:50:55 ERROR: #!#! at java.base/java.lang.Thread.run(Thread.java:833)

11:50:55 ERROR: #!#! Version Information: 11:50:55 ERROR: #!#! Skript: 2.7.0-beta2 (latest) 11:50:55 ERROR: #!#! Flavor: skriptlang-github 11:50:55 ERROR: #!#! Date: 23:34:46.821464600 11:50:55 ERROR: #!#! Bukkit: 1.19.2-R0.1-SNAPSHOT 11:50:55 ERROR: #!#! Minecraft: 1.19.2 11:50:55 ERROR: #!#! Java: 17.0.1 (OpenJDK 64-Bit Server VM 17.0.1+12) 11:50:55 ERROR: #!#! OS: Linux amd64 5.15.0-46-generic

11:50:55 ERROR: #!#! Server platform: Paper

11:50:55 ERROR: #!#! Current node: on load: (RandomEnchants.sk, line 1) 11:50:55 ERROR: #!#! Current item: null

11:50:55 ERROR: #!#! Thread: Server thread

11:50:55 ERROR: #!#! Language: english 11:50:55 ERROR: #!#! Link parse mode: DISABLED

11:50:55 ERROR: #!#! End of Error.

Other

I have nothing else to add.

Agreement

AyhamAl-Ali commented 1 year ago

Can you share the script that causes this error when reloaded

potatoeded commented 1 year ago
on load:
    clear {enchants::*}
    add Aqua Affinity to {enchants::*}  
    add Bane of Arthropods to {enchants::*}
    add Blast Protection to {enchants::*}  
    add Channeling to {enchants::*}  
    add Depth Strider to {enchants::*}  
    add Efficiency to {enchants::*}  
    add Feather Falling to {enchants::*}  
    add Fire Aspect to {enchants::*}  
    add Fire Protection to {enchants::*}
    add Flame to {enchants::*}  
    add Fortune to {enchants::*}  
    add Frost Walker to {enchants::*}  
    add Impaling to {enchants::*}  
    add Infinity to {enchants::*}  
    add Knockback to {enchants::*}  
    add Loyalty to {enchants::*}  
    add Looting to {enchants::*}  
    add Luck of the Sea to {enchants::*}  
    add Lure to {enchants::*}  
    add Mending to {enchants::*}  
    add Multishot to {enchants::*}  
    add Piercing to {enchants::*}  
    add Power to {enchants::*}  
    add Projectile Protection to {enchants::*}  
    add Protection to {enchants::*}  
    add Punch to {enchants::*}  
    add Quick Charge to {enchants::*} 
    add Respiration to {enchants::*}  
    add Riptide to {enchants::*}  
    add Sharpness to {enchants::*}  
    add Silk Touch to {enchants::*}  
    add Smite to {enchants::*}  
    add Thorns to {enchants::*}  
    add Unbreaking to {enchants::*}  
    add Curse of binding to {enchants::*}
    add Curse of vanishing to {enchants::*}
    clear {customenchants::*}
    add "Aquaman" to {customenchants::*}
    add "Bunny_Hop" to {customenchants::*}
    add "Cold_Steel" to {customenchants::*}
    add "Elemental_Protection" to {customenchants::*}
    add "Flame_Walker" to {customenchants::*}
    add "Fire_Shield" to {customenchants::*}
    add "Ice_Shield" to {customenchants::*}
    add "Hardened" to {customenchants::*}
    add "Night_Vision" to {customenchants::*}
    add "Regrowth" to {customenchants::*}
    add "Saturation" to {customenchants::*}
    add "Self-Destruction" to {customenchants::*}
    add "Sonic" to {customenchants::*}
    add "Bomber" to {customenchants::*}
    add "Hover" to {customenchants::*}
    add "Ender_Bow" to {customenchants::*}
    add "Ghast" to {customenchants::*}
    add "Confusing_Arrows" to {customenchants::*}
    add "Dragonfire_Arrows" to {customenchants::*}
    add "Electrified_Arrows" to {customenchants::*}
    add "Explosive_Arrows" to {customenchants::*}
    add "Poisoned_Arrows" to {customenchants::*}
    add "Withered_Arrows" to {customenchants::*}
    add "Blast_Mining" to {customenchants::*}
    add "Divine_Touch" to {customenchants::*}
    add "Haste" to {customenchants::*}
    add "Lucky_Miner" to {customenchants::*}
    add "Replanter" to {customenchants::*}
    add "Silk_Chest" to {customenchants::*}
    add "Smelter" to {customenchants::*}
    add "Telekinesis" to {customenchants::*}
    add "Treasures" to {customenchants::*}
    add "Tunnel" to {customenchants::*}
    add "Veinminer" to {customenchants::*}
    add "Bane_of_Netherspawn" to {customenchants::*}
    add "Blindness" to {customenchants::*}
    add "Confusion" to {customenchants::*}
    add "Cure" to {customenchants::*}
    add "Cutter" to {customenchants::*}
    add "Decapitator" to {customenchants::*}
    add "Double_Strike" to {customenchants::*}
    add "Exhaust" to {customenchants::*}
    add "Exp_Hunter" to {customenchants::*}
    add "Ice_Aspect" to {customenchants::*}
    add "Infernus" to {customenchants::*}
    add "Nimble" to {customenchants::*}
    add "Paralyze" to {customenchants::*}
    add "Rage" to {customenchants::*}
    add "Rocket" to {customenchants::*}
    add "Scavenger" to {customenchants::*}
    add "Surprise" to {customenchants::*}
    add "Temper" to {customenchants::*}
    add "Thrifty" to {customenchants::*}
    add "Thunder" to {customenchants::*}
    add "Vampire" to {customenchants::*}
    add "Venom" to {customenchants::*}
    add "Village_Defender" to {customenchants::*}
    add "Wither" to {customenchants::*}
    add "Curse_of_breaking" to {customenchants::*}
    add "Curse_of_misfortune" to {customenchants::*}
    add "Curse_of_fragility" to {customenchants::*}

on first join:
    broadcast "&5Welcome &l%player%! /help <page> to start!"
    execute player command "warp spawn"

function randomenchant(i: item type, p: player) :: enchantment type:
    set {_enchant} to random element out of {enchants::*}
    set {_level} to 1
    loop 1+{upgrade::%{_p}'s uuid%} times:
        if {_i} is enchanted with "%{_enchant}% %loop-value%" parsed as enchantment type:
            set {_level} to 1+loop-value
    if {_i} is not enchanted with "%{_enchant}% %{_level}%" parsed as enchantment type:
        add 1 to {stars::%{_p}'s uuid%}
    return "%{_enchant}% %{_level}%" parsed as enchantment type

function enchantplayers():
    loop all players:
        wait 1 tick
        if loop-player's gamemode is survival:
            set {_og} to {stars::%loop-value-1's uuid%}
            loop loop-value-1's inventory:
                set {_enchant} to randomenchant(loop-value-2, loop-value-1)
                enchant loop-value-2 with {_enchant} 
            add {_add} to {stars::%loop-value-1's uuid%}
            if {notification::%loop-value-1's uuid%} is set:
                wait 1 tick
                send "&5You got enchanted, but you have notifications off!" to loop-value-1
            else:
                wait 1 tick
                send "&5---Random enchant results notification---" to loop-value-1
                wait 1 tick
                send "&5/notification to disable this!" to loop-value-1
                wait 1 tick
                send "&5Inventory enchanted!" to loop-value-1
                wait 1 tick
                send "&5%{stars::%loop-value-1's uuid%} - {_og}% stars revieved!" to loop-value-1 
                wait 1 tick
                send "&5You now have %{stars::%loop-value-1's uuid%}% stars!" to loop-value-1 
                wait 1 tick
                send "&5---Random enchant stats notification---" to loop-value-1
                wait 1 tick
                send "&5Max Enchant Level: %1+{upgrade::%loop-value-1's uuid%}%" to loop-value-1
                wait 1 tick
                send "&5/upgrade to increase!" to loop-value-1
                wait 1 tick
                send "&5---Random enchant warnings---" to loop-value-1
                wait 1 tick
                if {stars::%loop-value-1's uuid%} - {_og} is 0:
                    set {_warning} to true
                    wait 1 tick
                    send "&cYou recieved no stars!" to loop-value-1
                    wait 1 tick
                    send "&cMake sure you have items that can be enchanted!" to loop-value-1
                if {_warning} is not set:
                    wait 1 tick
                    send "&c<none>" to loop-value-1
                wait 1 tick
                send "&5----------------------------------------" to loop-value-1
                wait 1 tick

function lootbox():
    loop all players:
        wait 1 tick
        set {_r} to random integer between 1 and 150
        if {_r} < 50:
            wait 1 tick
            give loop-player chest named "&fCommon Lootbox" with lore "&6Right click >> Open"
            send "&5You got a &fCommon Lootbox!" to loop-player
            wait 1 tick
        else:
            if {_r} < 90:
                wait 1 tick
                give loop-player chest named "&2Uncommon Lootbox" with lore "&6Right click >> Open"
                send "&5You got an &2Uncommon Lootbox!" to loop-player
                wait 1 tick
            else:
                if {_r} < 120:
                    wait 1 tick
                    give loop-player chest named "&9Rare Lootbox" with lore "&6Right click >> Open"
                    send "&5You got a &9Rare Lootbox!" to loop-player
                    wait 1 tick
                else:
                    if {_r} < 140:
                        wait 1 tick
                        give loop-player chest named "&5Epic Lootbox" with lore "&6Right click >> Open"
                        send "&5You got an Epic Lootbox!" to loop-player
                        wait 1 tick
                    else:
                        if {_r} < 150:
                            wait 1 tick
                            give loop-player chest named "&6Legendary Lootbox" with lore "&6Right click >> Open"
                            send "&5You got a &6Legendary Lootbox!" to loop-player
                            wait 1 tick

on right click with chest:
    if event-item's name is "&fCommon Lootbox":
        remove 1 of player's tool from player's tool
        execute console command "crate forceopen common %player%"
    if event-item's name is "&2Uncommon Lootbox":
        remove 1 of player's tool from player's tool
        execute console command "crate forceopen uncommon %player%"
    if event-item's name is "&9Rare Lootbox":
        remove 1 of player's tool from player's tool
        execute console command "crate forceopen rare %player%"
    if event-item's name is "&5Epic Lootbox":
        remove 1 of player's tool from player's tool
        execute console command "crate forceopen epic %player%"
    if event-item's name is "&6Legendary Lootbox":
        remove 1 of player's tool from player's tool
        execute console command "crate forceopen legendary %player%"

command /resetupgrades <offline player>:
    permission: op
    trigger:
        delete {upgrade::%arg-1's uuid%}
        send "&5Successful deletion!"
        send "&5You now have no upgrade levls!" to arg-1

command /infstars <offline player>:
    permission: op
    trigger:
        add 1000000 to {stars::%arg-1's uuid%}
        execute player command "stars"

command /randomenchant:
    permission: op
    trigger:
        enchantplayers()

command /lootboxall:
    permission: op
    trigger:
        lootbox()

command /upgrade:
    trigger:
        loop 1+{upgrade::%player's uuid%} times:
            loop loop-value times:
                add 10 to {_cost}
        if {stars::%player's uuid%} < {_cost}:
            send "&cYou need %{_cost} - {stars::%player's uuid%}% more stars to afford this!"
        else:
            subtract {_cost} from {stars::%player's uuid%}
            add 1 to {upgrade::%player's uuid%}
            send "&5Successfully upgraded to level %1+{upgrade::%player's uuid%}%!"
            execute player command "stars"

command /help <integer>:
    trigger:
        set {_p} to arg-1
        if {_p} < 1:
            set {_p} to 1
        if {_p} > 4:
            set {_p} to 4
        if {_p} is 1:
            send "&5Page 1 (Next: Page 2)"
            send "&5/help (this command)"
            send "&5/rtp to randomly teleport"
            send "&5Tip - Use this to get out of spawn if it is too dangerous!"
            send "&5/upgrade to upgrade random enchants"
            send "&5/customenchant to get random custom enchant (scales with /upgrade)"
            send "&5Tip - To see custom enchants, you might have to wait a few seconds!"
            send "&5/recipes to view custom recipes"
        if {_p} is 2:
            send "&5Page 2 (Previous: Page 1) (Next: Page 3)"
            send "&5/stars to see how many stars you have"
            send "&5/warp spawn to warp to spawn"
            send "&5Tip - spawn is unsafe so only go there to open crates!"
            send "&5/sethome to set a home"
            send "&5/delhome to delete a home"
            send "&5/home to teleport to a home"
        if {_p} is 3:
            send "&5Page 3 (Previous: Page 2) (Next: Page 4)"
            send "&5/ec to open your enderchest"
            send "&5/trash to open up the bin"
            send "&5Tip - bin stuff you don't want!"
            send "&5/notification to disable enchant notifications"
            send "&5/tpa to attempt to teleport to someone"
            send "&5/tpaccept accept the teleport attempt"
        if {_p} is 4:
            send "&5Page 4 (Previous: Page 3)"
            send "&5/tpacancel to stop /tpa"

command /customenchant:
    trigger:
        if player's tool is air:
            send "&cAir isn't enchantable!"
        else:
            loop 1+{upgrade::%player's uuid%} times:
                add 10 to {_cost}
            if {stars::%player's uuid%} < {_cost}:
                send "&cYou need %{_cost} - {stars::%player's uuid%}% more stars to afford this!"
            else:
                subtract {_cost} from {stars::%player's uuid%}
                op player
                execute player command "ie enchant %random element out of {customenchants::*}% %{upgrade::%player's uuid%}%"
                deop player
                send "&5Successfully enchanted!"
                execute player command "stars"

command /notification:
    trigger:
        if {notification::%player's uuid%} is set:
            delete {notification::%player's uuid%}
            send "&5You have turned notifications on!"
        else:
            set {notification::%player's uuid%} to true
            send "&5You have turned notifications off!"

command /stars:
    trigger:
        send "&5Star count: %{stars::%player's uuid%}%"

every 1 minute:
    enchantplayers()

every 5 minutes:
    lootbox()
potatoeded commented 1 year ago

I think its with all the variables, but it is the fasted loading method by a longshot.

Fusezion commented 1 year ago

I think its with all the variables, but it is the fasted loading method by a longshot.

functions go a long way and actually this really wouldn't be "fastest", using set {customenchant::index} to blah would be faster as from what I remember hearing add ends up looping the whole list for the ending entry, at the same time I couldn't find anything to back that up

sovdeeth commented 1 year ago

I think its with all the variables, but it is the fasted loading method by a longshot.

functions go a long way and actually this really wouldn't be "fastest", using set {customenchant::index} to blah would be faster as from what I remember hearing add ends up looping the whole list for the ending entry, at the same time I couldn't find anything to back that up

image

sovdeeth commented 1 year ago

but the error seems to be the classic "parsed as particle effect instead of what it should actually be", likely from flame

TheLimeGlass commented 1 year ago

Pull request available at https://github.com/SkriptLang/Skript/pull/5503