DiSkyOrg / DiSky

The best Skript add-on for Discord management! Slash commands, interaction, components, modal and much more available!
https://disky.me/
Apache License 2.0
42 stars 12 forks source link

DiSky crash on script reload #208

Closed vexio closed 3 months ago

vexio commented 3 months ago

Versions

Description

Whenever I reload my bot script, I get DiSky Skript error. Error:

[07:16:48 ERROR]: #!#! 
[07:16:48 ERROR]: #!#! [Skript] Severe Error:
[07:16:48 ERROR]: #!#! Exception occurred in Skript's main command
[07:16:48 ERROR]: #!#! Used command: /sk reload whitelist
[07:16:48 ERROR]: #!#! 
[07:16:48 ERROR]: #!#! Something went horribly wrong with Skript.
[07:16:48 ERROR]: #!#! This issue is NOT your fault! You probably can't fix it yourself, either.
[07:16:48 ERROR]: #!#! It looks like you are using some plugin(s) that alter how Skript works (addons).
[07:16:48 ERROR]: #!#! Here is full list of them:
[07:16:48 ERROR]: #!#! DiSky v4.17.0 
[07:16:48 ERROR]: #!#! We could not identify which of those are specially related, so this might also be Skript issue.
[07:16:48 ERROR]: #!#! You should try disabling those plugins one by one, trying to find which one causes it.
[07:16:48 ERROR]: #!#! If the error doesn't disappear even after disabling all listed plugins, it is probably Skript issue.
[07:16:48 ERROR]: #!#! In that case, you will be given instruction on how should you report it.
[07:16:48 ERROR]: #!#! On the other hand, if the error disappears when disabling some plugin, report it to author of that plugin.
[07:16:48 ERROR]: #!#! Only if the author tells you to do so, report it to Skript's issue tracker.
[07:16:48 ERROR]: #!#! 
[07:16:48 ERROR]: #!#! Stack trace:
[07:16:48 ERROR]: #!#! java.lang.NullPointerException: Cannot invoke "ch.njol.skript.config.Node.getKey()" because "this.node" is null
[07:16:48 ERROR]: #!#!     at DiSky 4.17.0.jar//info.itsthesky.disky.elements.structures.slash.models.SlashCommandInformation.hashCode(SlashCommandInformation.java:27)
[07:16:48 ERROR]: #!#!     at java.base/java.util.HashMap.hash(HashMap.java:338)
[07:16:48 ERROR]: #!#!     at java.base/java.util.HashMap.put(HashMap.java:618)
[07:16:48 ERROR]: #!#!     at java.base/java.util.HashSet.add(HashSet.java:229)
[07:16:48 ERROR]: #!#!     at DiSky 4.17.0.jar//info.itsthesky.disky.elements.structures.slash.StructSlashCommand.unload(StructSlashCommand.java:227)
[07:16:48 ERROR]: #!#!     at Skript-2.8.5.jar//ch.njol.skript.ScriptLoader.unloadScripts(ScriptLoader.java:830)
[07:16:48 ERROR]: #!#!     at Skript-2.8.5.jar//ch.njol.skript.ScriptLoader.unloadScript(ScriptLoader.java:864)
[07:16:48 ERROR]: #!#!     at Skript-2.8.5.jar//ch.njol.skript.SkriptCommand.onCommand(SkriptCommand.java:189)
[07:16:48 ERROR]: #!#!     at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45)
[07:16:48 ERROR]: #!#!     at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:168)
[07:16:48 ERROR]: #!#!     at org.bukkit.craftbukkit.v1_20_R3.CraftServer.dispatchCommand(CraftServer.java:1013)
[07:16:48 ERROR]: #!#!     at org.bukkit.craftbukkit.v1_20_R3.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64)
[07:16:48 ERROR]: #!#!     at com.mojang.brigadier.context.ContextChain.runExecutable(ContextChain.java:73)
[07:16:48 ERROR]: #!#!     at net.minecraft.commands.execution.tasks.ExecuteCommand.a(ExecuteCommand.java:30)
[07:16:48 ERROR]: #!#!     at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:13)
[07:16:48 ERROR]: #!#!     at net.minecraft.commands.execution.UnboundEntryAction.a(UnboundEntryAction.java:8)
[07:16:48 ERROR]: #!#!     at net.minecraft.commands.execution.CommandQueueEntry.a(CommandQueueEntry.java:5)
[07:16:48 ERROR]: #!#!     at net.minecraft.commands.execution.ExecutionContext.a(ExecutionContext.java:103)
[07:16:48 ERROR]: #!#!     at net.minecraft.commands.CommandDispatcher.a(CommandDispatcher.java:442)
[07:16:48 ERROR]: #!#!     at net.minecraft.commands.CommandDispatcher.performCommand(CommandDispatcher.java:344)
[07:16:48 ERROR]: #!#!     at net.minecraft.commands.CommandDispatcher.a(CommandDispatcher.java:331)
[07:16:48 ERROR]: #!#!     at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2301)
[07:16:48 ERROR]: #!#!     at net.minecraft.server.network.PlayerConnection.lambda$handleChatCommand$15(PlayerConnection.java:2261)
[07:16:48 ERROR]: #!#!     at net.minecraft.util.thread.IAsyncTaskHandler.b(IAsyncTaskHandler.java:59)
[07:16:48 ERROR]: #!#!     at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
[07:16:48 ERROR]: #!#!     at net.minecraft.server.TickTask.run(TickTask.java:18)
[07:16:48 ERROR]: #!#!     at net.minecraft.util.thread.IAsyncTaskHandler.d(IAsyncTaskHandler.java:149)
[07:16:48 ERROR]: #!#!     at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(IAsyncTaskHandlerReentrant.java:24)
[07:16:48 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1498)
[07:16:48 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:194)
[07:16:48 ERROR]: #!#!     at net.minecraft.util.thread.IAsyncTaskHandler.x(IAsyncTaskHandler.java:123)
[07:16:48 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.bl(MinecraftServer.java:1475)
[07:16:48 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1398)
[07:16:48 ERROR]: #!#!     at net.minecraft.util.thread.IAsyncTaskHandler.c(IAsyncTaskHandler.java:133)
[07:16:48 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.w_(MinecraftServer.java:1376)
[07:16:48 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1265)
[07:16:48 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:323)
[07:16:48 ERROR]: #!#!     at java.base/java.lang.Thread.run(Thread.java:1583)
[07:16:48 ERROR]: #!#! 
[07:16:48 ERROR]: #!#! Version Information:
[07:16:48 ERROR]: #!#!   Skript: 2.8.5 (latest)
[07:16:48 ERROR]: #!#!     Flavor: skriptlang-github
[07:16:48 ERROR]: #!#!     Date: 16:49:26.326703600
[07:16:48 ERROR]: #!#!   Bukkit: 1.20.4-R0.1-SNAPSHOT
[07:16:48 ERROR]: #!#!   Minecraft: 1.20.4
[07:16:48 ERROR]: #!#!   Java: 21.0.3 (OpenJDK 64-Bit Server VM 21.0.3+9-LTS)
[07:16:48 ERROR]: #!#!   OS: Linux amd64 5.4.0-144-generic
[07:16:48 ERROR]: #!#! 
[07:16:48 ERROR]: #!#! Server platform: Paper
[07:16:48 ERROR]: #!#! 
[07:16:48 ERROR]: #!#! Current node: null
[07:16:48 ERROR]: #!#! Current item: null
[07:16:48 ERROR]: #!#! 
[07:16:48 ERROR]: #!#! Thread: Server thread
[07:16:48 ERROR]: #!#! 
[07:16:48 ERROR]: #!#! Language: english
[07:16:48 ERROR]: #!#! Link parse mode: DISABLED
[07:16:48 ERROR]: #!#! 
[07:16:48 ERROR]: #!#! End of Error.
[07:16:48 ERROR]: #!#!

script:

options:
    p: <##ffb861>@<##ffb861>
    t: <##ffb861>
    h: &f
    permissionError: &cInsufficient permissions.

    botName: whitelist

define new bot named "{@botName}":
    token: "hidden"
    intents: default intents
    policy: all
    compression: none

    auto reconnect: true
    force reload: true

    on ready:
        set the presence of the bot named "{@botName}" to listening "/register"
        set the online status of bot "{@botName}" to online
        send "{@p} {@h}%event-bot%{@t} loaded and connected successfully." to all ops
    on shutdown:
        set the online status of bot "{@botName}" to offline

slash command register <string="username">:
    description: Whitelist a Minecraft Java username! Please make sure you're spelling correctly
    arguments:
        username:
            description: Your Minecraft username
    cooldown: 2 seconds
    on cooldown:
        reply with "You've already submitted a username! If this is a mistake, please contact a Moderator."
    bot: {@botName}
    trigger:
        addToWhitelist({_arg1})
        reply with "%mention tag of event-user% player %{_arg1}% has been whitelisted."

function isWhitelisted(p: string) :: boolean:
    loop {whitelist.players::*}:
        if loop-value = {_p}:
            return true
            exit
    return false

function addToWhitelist(p: string):
    if isWhitelisted({_p}) = false:
        add {_p} to {whitelist.players::*}
        send "{@p} Player added to whitelist: {@h}%{_p}%" to all ops
    else:
        send "[{@botName}][ERROR] %{_p}% already whitelisted" to console

function removeFromWhitelist(p: string):
    if isWhitelisted({_p}) = true:
        remove {_p} from {whitelist.players::*}
        send "{@p} Player removed from whitelist: {@h}%{_p}%" to all ops
    else:
        send "[{@botName}][ERROR] %{_p}% can't be removed from whitelist" to console

command /whitelist [<string="?">] [<string>]:
    permission: command.whitelist
    permission message: {@permissionError}
    trigger:
        if arg 1 = "?" or "help":
            send "{@p} {@botName} commands"
            send "{@h}▬ /whitelist add <player>"
            send "{@h}▬ /whitelist remove <player>"
            send "{@h}▬ /whitelist renew <player>"
            send "{@h}▬ /whitelist time <player>"
            send "{@h}▬ /whitelist list"
        else if arg 1 = "add":
            if arg 2 is set:
                addToWhitelist(arg-2)
            else:
                player command "/whitelist"
        else if arg 1 = "remove":
            if arg 2 is set:
                removeFromWhitelist(arg-2)
            else:
                player command "/whitelist"
        else if arg 1 = "time":
            if arg 2 is set:
                if isWhitelisted(arg-2) = true:

Acknowledgment

vexio commented 3 months ago

Fixed in DiSky 0.14.1+Nightly