Solved MySQL spitting errors [SKELLETT]

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

CKR367

Member
Feb 1, 2017
64
2
0
So I am trying to grab data from my MySQL database when a player joins, but I keep getting errors. I have checked that everything is spelled correctly and the capitalization is correct. I have marked the line that is erroring out in the code below. I am using skellett for the MySQL support.

CODE:

code_language.skript:
on load:
    connect to mysql
    mysql update "CREATE TABLE IF NOT EXISTS `playerdata` ( `ID` INT NULL DEFAULT NULL AUTO_INCREMENT , `Username` VARCHAR(16) NOT NULL , `UUID` VARCHAR(36) NOT NULL , `Rank` VARCHAR(5) NOT NULL DEFAULT 'None' , `Punished` VARCHAR(5) NOT NULL DEFAULT 'False' , UNIQUE (`id`)) ENGINE = InnoDB;"

function fetchplayerdata(p: player):
    set {_uuid} to uuid of {_p}
## ERROR LINE    set {_fetchuuid} to first element of objects in column "UUID" from result of query "SELECT * FROM `playerdata` WHERE UUID = '%{_uuid}%'" and close ## ERROR LINE
    if {_fetchuuid} is not set:
        mysql update "INSERT INTO `playerdata` (`UUID`, `Username`) VALUES ('%{_uuid}%', '%{_p}%')"
   
on join:
    set join message to ""
    send "&6Player Database &8> &7Fetching player data...."
    set {_p} to player
    fetchplayerdata({_p})
    send "&6Player Database &8> &7Player data successfully fetched."
    stop

[09:08:38] [Server thread/ERROR]: #!#!
[09:08:38] [Server thread/ERROR]: #!#! [Skript] Severe Error:
[09:08:38] [Server thread/ERROR]: #!#!
[09:08:38] [Server thread/ERROR]: #!#! Something went horribly wrong with Skript.
[09:08:38] [Server thread/ERROR]: #!#! This issue is NOT your fault! You probably can't fix it yourself, either.
[09:08:38] [Server thread/ERROR]: #!#! It looks like you are using some plugin(s) that alter how Skript works (addons).
[09:08:38] [Server thread/ERROR]: #!#! Here is full list of them:
[09:08:38] [Server thread/ERROR]: #!#! Skellett (https://forums.skunity.com/resources/skellett-the-addon-with-a-beast-name.24/) TuSKe (github.com/Tuke-Nuke/TuSKe)
[09:08:38] [Server thread/ERROR]: #!#! We could not identify which of those are specially related, so this might also be Skript issue.
[09:08:38] [Server thread/ERROR]: #!#! You should try disabling those plugins one by one, trying to find which one causes it.
[09:08:38] [Server thread/ERROR]: #!#! If the error doesn't disappear even after disabling all listed plugins, it is probably Skript issue.
[09:08:38] [Server thread/ERROR]: #!#! In that case, you will be given instruction on how should you report it.
[09:08:38] [Server thread/ERROR]: #!#! On the other hand, if the error disappears when disabling some plugin, report it to author of that plugin.
[09:08:38] [Server thread/ERROR]: #!#! Only if the author tells you to do so, report it as Skript issue (url below)
[09:08:38] [Server thread/ERROR]: #!#! Issue tracker: https://github.com/bensku/Skript/issues (only if you know what you're doing!)
[09:08:38] [Server thread/ERROR]: #!#!
[09:08:38] [Server thread/ERROR]: #!#! Stack trace:
[09:08:38] [Server thread/ERROR]: #!#! ch.njol.skript.SkriptAPIException: UnparsedLiterals must be converted before use
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.UnparsedLiteral.invalidAccessException(UnparsedLiteral.java:273)
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.UnparsedLiteral.iterator(UnparsedLiteral.java:308)
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.UnparsedLiteral.iterator(UnparsedLiteral.java:1)
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.ExpressionList$1.hasNext(ExpressionList.java:140)
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.expressions.ExprElement.get(ExprElement.java:73)
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.util.SimpleExpression.getArray(SimpleExpression.java:104)
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.effects.EffChange.execute(EffChange.java:268)
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.Effect.run(Effect.java:52)
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61)
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89)
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.Trigger.execute(Trigger.java:55)
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.function.ScriptFunction.execute(ScriptFunction.java:95)
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.function.Function.execute(Function.java:112)
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.function.FunctionReference.execute(FunctionReference.java:193)
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.function.EffFunctionCall.execute(EffFunctionCall.java:53)
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.Effect.run(Effect.java:52)
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61)
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89)
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.Trigger.execute(Trigger.java:55)
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.SkriptEventHandler.check(SkriptEventHandler.java:151)
[09:08:38] [Server thread/ERROR]: #!#! at ch.njol.skript.SkriptEventHandler$1.execute(SkriptEventHandler.java:109)
[09:08:38] [Server thread/ERROR]: #!#! at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
[09:08:38] [Server thread/ERROR]: #!#! at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502)
[09:08:38] [Server thread/ERROR]: #!#! at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487)
[09:08:38] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_11_R1.PlayerList.onPlayerJoin(PlayerList.java:327)
[09:08:38] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_11_R1.PlayerList.a(PlayerList.java:160)
[09:08:38] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_11_R1.LoginListener.b(LoginListener.java:147)
[09:08:38] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_11_R1.LoginListener.F_(LoginListener.java:57)
[09:08:38] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_11_R1.NetworkManager.a(NetworkManager.java:233)
[09:08:38] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_11_R1.ServerConnection.c(ServerConnection.java:140)
[09:08:38] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_11_R1.MinecraftServer.D(MinecraftServer.java:842)
[09:08:38] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:399)
[09:08:38] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:678)
[09:08:38] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:576)
[09:08:38] [Server thread/ERROR]: #!#! at java.lang.Thread.run(Thread.java:748)
[09:08:38] [Server thread/ERROR]: #!#!
[09:08:38] [Server thread/ERROR]: #!#! Version Information:
[09:08:38] [Server thread/ERROR]: #!#! Skript: 2.2-dev32
[09:08:38] [Server thread/ERROR]: #!#! Bukkit: 1.11.2-R0.1-SNAPSHOT
[09:08:38] [Server thread/ERROR]: #!#! Minecraft: 1.11.2
[09:08:38] [Server thread/ERROR]: #!#! Java: 1.8.0_131 (OpenJDK 64-Bit Server VM 25.131-b11)
[09:08:38] [Server thread/ERROR]: #!#! OS: Linux amd64 4.4.0-87-generic
[09:08:38] [Server thread/ERROR]: #!#!
[09:08:38] [Server thread/ERROR]: #!#! Running CraftBukkit: false
[09:08:38] [Server thread/ERROR]: #!#! Running Spigot (or compatible): true
[09:08:38] [Server thread/ERROR]: #!#! Running Paper (or compatible): false
[09:08:38] [Server thread/ERROR]: #!#!
[09:08:38] [Server thread/ERROR]: #!#! Current node: null
[09:08:38] [Server thread/ERROR]: #!#! Current item: set {_fetchuuid}(as java.lang.Object) to the first element of ('objects in column "UUID" from result of query "SELECT * FROM `playerdata` WHERE UUID = '%{_uuid}%'"' and 'close')[class java.lang.Object]
[09:08:38] [Server thread/ERROR]: #!#! Thread: Server thread
[09:08:38] [Server thread/ERROR]: #!#!
[09:08:38] [Server thread/ERROR]: #!#! Language: english
[09:08:38] [Server thread/ERROR]: #!#! Link parse mode: DISABLED
[09:08:38] [Server thread/ERROR]: #!#!
[09:08:38] [Server thread/ERROR]: #!#! End of Error.
[09:08:38] [Server thread/ERROR]: #!#!
Skript Version: dev32
Addons:
Skellett - v1.9.6b
TuSKe - v1.8.1
 
Last edited:
Turns out I was using the wrong syntax all long.
This is the fix:

code_language.skript:
    set {_fetchplayerdata} to mysql result of query "SELECT * FROM `playerdata` WHERE UUID = '%{_uuid}%'"
    set {_playerdata::*} to mysql string "UUID" in {_fetchplayerdata}
 
  • Like
Reactions: L0v0lup
Status
Not open for further replies.