btk5h / skript-json

JSON support for Skript
MIT License
9 stars 1 forks source link

Support for more advanced json #1

Closed ghost closed 7 years ago

ghost commented 7 years ago

Saving locations and blocks working, but not reading.


[15:33:15 WARN]: Unexpected character (C) at position 1.
[15:33:15 WARN]:        at org.json.simple.parser.Yylex.yylex(Yylex.java:610)
[15:33:15 WARN]:        at org.json.simple.parser.JSONParser.nextToken(JSONParser.java:269)
[15:33:15 WARN]:        at org.json.simple.parser.JSONParser.parse(JSONParser.java:118)
[15:33:15 WARN]:        at org.json.simple.parser.JSONParser.parse(JSONParser.java:81)
[15:33:15 WARN]:        at org.json.simple.parser.JSONParser.parse(JSONParser.java:75)
[15:33:15 WARN]:        at com.btk5h.skriptjson.skript.EffJSONToVariable.execute(EffJSONToVariable.java:70)
[15:33:15 WARN]:        at ch.njol.skript.lang.Effect.run(Effect.java:54)
[15:33:15 WARN]:        at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:65)
[15:33:15 WARN]:        at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:93)
[15:33:15 WARN]:        at ch.njol.skript.lang.Trigger.execute(Trigger.java:53)
[15:33:15 WARN]:        at ch.njol.skript.command.ScriptCommand.execute2(ScriptCommand.java:222)
[15:33:15 WARN]:        at ch.njol.skript.command.ScriptCommand.execute(ScriptCommand.java:184)
[15:33:15 WARN]:        at ch.njol.skript.command.Commands.handleCommand(Commands.java:270)
[15:33:15 WARN]:        at ch.njol.skript.command.Commands$1.onPlayerCommand(Commands.java:165)
[15:33:15 WARN]:        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[15:33:15 WARN]:        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[15:33:15 WARN]:        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[15:33:15 WARN]:        at java.lang.reflect.Method.invoke(Method.java:498)
[15:33:15 WARN]:        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302)
[15:33:15 WARN]:        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
[15:33:15 WARN]:        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502)
[15:33:15 WARN]:        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487)
[15:33:15 WARN]:        at net.minecraft.server.v1_11_R1.PlayerConnection.handleCommand(PlayerConnection.java:1336)
[15:33:15 WARN]:        at net.minecraft.server.v1_11_R1.PlayerConnection.a(PlayerConnection.java:1179)
[15:33:15 WARN]:        at net.minecraft.server.v1_11_R1.PacketPlayInChat.a(PacketPlayInChat.java:45)
[15:33:15 WARN]:        at net.minecraft.server.v1_11_R1.PacketPlayInChat.a(PacketPlayInChat.java:1)
[15:33:15 WARN]:        at net.minecraft.server.v1_11_R1.PlayerConnectionUtils$1.run(SourceFile:13)
[15:33:15 WARN]:        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[15:33:15 WARN]:        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[15:33:15 WARN]:        at net.minecraft.server.v1_11_R1.SystemUtils.a(SourceFile:46)
[15:33:15 WARN]:        at net.minecraft.server.v1_11_R1.MinecraftServer.D(MinecraftServer.java:747)
[15:33:15 WARN]:        at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:399)
[15:33:15 WARN]:        at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:678)
[15:33:15 WARN]:        at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:576)
[15:33:15 WARN]:        at java.lang.Thread.run(Thread.java:745)
btk5h commented 7 years ago

Can you post some code that can be used to replicate this?

ghost commented 7 years ago
command /aaa:
    trigger:
        set {_t::*} to target block, target block and block 1 under target block, 1, 2 and 3, 4
        set {_x} to json form of {_t::*}
        map json {_x} to {_data::*}
        loop {_data::*}:
            send "%loop-value%"
        send {_x}
command /bbb:
    trigger:
        set {_t::*} to target block, target block and block 1 under target block
        set {_x} to json form of {_t::*}
        map json {_x} to {_data::*}
        loop {_data::*}:
            send "%loop-value%"
        send {_x}
command /ccc:
    trigger:
        add location of player to {_t::*}
        set {_x} to json form of {_t::*}
        map json {_x} to {_data::*}
        loop {_data::*}:
            send "%loop-value%"
        send {_x}
This server is running CraftBukkit version git-Spigot-65a0347-a552117 (MC: 1.11.2) (Implementing API version 1.11.2-R0.1-SNAPSHOT)
Skript version 2.2-dev24b
Customize Minecraft's mechanics with simple scripts written in plain English sentences.
Website: http://njol.ch/projects/skript
Authors: Njol, Mirreski, bensku, nfell2009, joeuguce99, RealGatt, RoyCurtis, tim740 and Tuke-Nuke
btk5h commented 7 years ago

Fixed in v1.1.0. Locations are now serialized into JSON objects. Unsupported types are serialized using Skript's built-in serializer.