cooffeeRequired / skJson

About Script Addon for using Json (Gson) in script
GNU General Public License v3.0
16 stars 3 forks source link

Mapping json #63

Closed DaRealPilot closed 1 year ago

DaRealPilot commented 1 year ago

Appears maping json is broken. I've done a little testing and I believe its due to the "LazilyParsedNumber" not working with variables or something. CODE:


on join:
    Load(player)
    if json file "plugins/Skript/Json/%player's uuid%.json" does not exists:
        new json file "plugins/Skript/Json/%player's uuid%.json"
on quit:
    Save(player, true)
every 3 minutes:
    loop all players:
        Save(loop-player)
        wait a second

function Save(p: player, b: boolean=false):
    set {_json} to {PlayerData::%{_p}'s uuid%::*}'s form
    write {_json} to json file "plugins/Skript/Json/%{_p}'s uuid%.json"
    if {_b} = true:/
        delete {PlayerData::%{_p}'s uuid%::*}
function Load(p: player):
    set {_json} to json from file "plugins/Skript/Json/%{_p}'s uuid%.json"
    map {_json} to {_a::*}
    loop indexes of {_a::*}:
        if {_a::%loop-value%} is set:
            set {PlayerData::%{_p}'s uuid%::%loop-value%} to "%{_a::%loop-value%}%"
            broadcast "%loop-value% | %{_a::%loop-value%}%"
        broadcast "%loop-value% | %{_a::%loop-value%}% %class of {_a::%loop-value%}%"
    broadcast "A::*"```

(mapping to a non-local variable immediately breaks everything)
cooffeeRequired commented 1 year ago

Hello there, Send me minecraft version, skript version also skjson version

ghost commented 1 year ago

image Everything works as expected

ghost commented 1 year ago

image

ghost commented 1 year ago

image And another example

DaRealPilot commented 1 year ago

2.8.5, (also tried 2.8.6) 1.20.1 skript 2.6.4 image

cooffeeRequired commented 1 year ago

Can you show me the vid or simi-lar thing or screenshots

DaRealPilot commented 1 year ago

I got everything working with that, I'm not sure why it wasn't mapping before I got a stack trace about Variables.toString() or something, I just tried doing it again with strings and got an error once but I cant repeat it. Thanks for helping, although I'm having some troubles with after mapping, I need to retain the index within a list but its not doing that.

cooffeeRequired commented 1 year ago

What exactly do you mean preserve the index?

DaRealPilot commented 1 year ago

{ "mult": 2, "pets": [ "1,0,250", "1,0,250" ] } It saves it as a list, even though the indexes are 10 and 11. I need the index to use later

Some testing: When they are not the values directly next to each other it appears to work. image

DaRealPilot commented 1 year ago

[18:22:57 INFO]: DjDisaster issued server command: /pets [18:23:04 INFO]: DjDisaster issued server command: /

18:23:06 ERROR: #!#! [Skript] Severe Error:

18:23:06 ERROR: #!#! Something went horribly wrong with Skript. 18:23:06 ERROR: #!#! This issue is NOT your fault! You probably can't fix it yourself, either. 18:23:06 ERROR: #!#! It looks like you are using some plugin(s) that alter how Skript works (addons). 18:23:06 ERROR: #!#! Here is full list of them: 18:23:06 ERROR: #!#! skJson v2.8.5 (https://github.com/SkJsonTeam/skJson) skript-reflect v2.3 (https://github.com/TPGamesNL/skript-reflect) SkBee v2.16.1 (https://github.com/ShaneBeee/SkBee) 18:23:06 ERROR: #!#! We could not identify which of those are specially related, so this might also be Skript issue. 18:23:06 ERROR: #!#! You should try disabling those plugins one by one, trying to find which one causes it. 18:23:06 ERROR: #!#! If the error doesn't disappear even after disabling all listed plugins, it is probably Skript issue. 18:23:06 ERROR: #!#! In that case, you will be given instruction on how should you report it. 18:23:06 ERROR: #!#! On the other hand, if the error disappears when disabling some plugin, report it to author of that plugin. 18:23:06 ERROR: #!#! Only if the author tells you to do so, report it to Skript's issue tracker.

18:23:06 ERROR: #!#! Stack trace: 18:23:06 ERROR: #!#! ch.njol.skript.SkriptAPIException: Serializer of number must override newInstance(), canBeInstantiated() or mustSyncDeserialization() if its class does not have a nullary constructor 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.classes.Serializer.newInstance(Serializer.java:79) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.yggdrasil.Yggdrasil.newInstance(Yggdrasil.java:335) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.yggdrasil.Yggdrasil.isSerializable(Yggdrasil.java:154) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.yggdrasil.YggdrasilOutputStream.writeGenericObject(YggdrasilOutputStream.java:173) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.yggdrasil.YggdrasilOutputStream.writeObject(YggdrasilOutputStream.java:249) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.registrations.Classes.serialize(Classes.java:724) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.variables.Variables.serialize(Variables.java:548) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.variables.Variables.serialize(Variables.java:542) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.variables.Variables.saveVariableChange(Variables.java:552) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.variables.Variables.setVariable(Variables.java:385) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.variables.Variables.setVariable(Variables.java:376) 18:23:06 ERROR: #!#! at skJson-2.8.5.jar//cz.coffee.core.mapping.JsonMap.primitive(JsonMap.java:60) 18:23:06 ERROR: #!#! at skJson-2.8.5.jar//cz.coffee.core.mapping.JsonMap.lambda$toList$0(JsonMap.java:46) 18:23:06 ERROR: #!#! at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) 18:23:06 ERROR: #!#! at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) 18:23:06 ERROR: #!#! at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133) 18:23:06 ERROR: #!#! at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845) 18:23:06 ERROR: #!#! at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) 18:23:06 ERROR: #!#! at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) 18:23:06 ERROR: #!#! at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) 18:23:06 ERROR: #!#! at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) 18:23:06 ERROR: #!#! at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) 18:23:06 ERROR: #!#! at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) 18:23:06 ERROR: #!#! at skJson-2.8.5.jar//cz.coffee.core.mapping.JsonMap.toList(JsonMap.java:43) 18:23:06 ERROR: #!#! at skJson-2.8.5.jar//cz.coffee.skript.mapping.EffJsonToSkriptList.execute(EffJsonToSkriptList.java:47) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.lang.Effect.run(Effect.java:50) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.lang.Trigger.execute(Trigger.java:56) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.lang.function.ScriptFunction.execute(ScriptFunction.java:85) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.lang.function.Function.execute(Function.java:129) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.lang.function.FunctionReference.execute(FunctionReference.java:299) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.lang.function.EffFunctionCall.execute(EffFunctionCall.java:52) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.lang.Effect.run(Effect.java:50) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.command.Commands.handleEffectCommand(Commands.java:290) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.command.Commands$3$1.call(Commands.java:220) 18:23:06 ERROR: #!#! at Skript-2.6.4.jar//ch.njol.skript.command.Commands$3$1.call(Commands.java:217) 18:23:06 ERROR: #!#! at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftFuture.run(CraftFuture.java:88) 18:23:06 ERROR: #!#! at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:480) 18:23:06 ERROR: #!#! at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1480) 18:23:06 ERROR: #!#! at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:447) 18:23:06 ERROR: #!#! at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1394) 18:23:06 ERROR: #!#! at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1171) 18:23:06 ERROR: #!#! at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:318)


    delete GetMob({_p})
    delete {PlayerData::%{_p}'s uuid%::SpawnedMob}
    set {PlayerData::%{_p}'s uuid%::Pets::4323} to ""
    set {PlayerData::%{_p}'s uuid%::VaultItems::4323} to ""
    set {_json} to {PlayerData::%{_p}'s uuid%::*}'s form
    write {_json} to json file "plugins/Skript/Json/%{_p}'s uuid%.json"
    if {_b} = true:
        delete {PlayerData::%{_p}'s uuid%::*}
function Load(p: player):
    set {_json} to json from file "plugins/Skript/Json/%{_p}'s uuid%.json"
    map {_json} to {PlayerData::%{_p}'s uuid%::*}```

{
    "mult": 1.75,
    "pets": {
        "10": "1,0,250",
        "4323": ""
    },
    "plot": 0,
    "vaultitems": [
        ""
    ]
}
cooffeeRequired commented 1 year ago

Ill check soon, try 2.9 beta

DaRealPilot commented 1 year ago

[18:40:51 INFO]: [SkJson] Enabling SkJson v2.9 [18:40:51 INFO]: [SkJson] NBTAPI NMS support 'MC1_20_R1' loaded! [18:40:51 INFO]: [SkJson] NBTAPI Was loaded successfully. [18:40:51 INFO]: [SkJson] Error ----------------------------------------------------------------------------------------------------------- [18:40:51 INFO]: [SkJson] Error This version doesn't support a older version of srkipt 2.6.4 [18:40:51 INFO]: [SkJson] Error Use older version https://github.com/SkJsonTeam/skJson/releases/tag/2.8.6 [18:40:51 INFO]: [SkJson] Error Or update skript to 2.7+ [18:40:51 INFO]: [SkJson] Error ----------------------------------------------------------------------------------------------------------- [18:40:51 INFO]: [SkJson] Disabling SkJson v2.9 [18:40:51 INFO]: [SkJson] JsonWatcher Trying to unregister all watchers! [18:40:51 INFO]: [SkJson] JsonWatcher Unregistering all watchers was successful! [18:40:51 INFO]: [SkJson] Goodbye! SkJson is Disabled! [18:40:51 INFO]: [SkJson] Hurray! SkJson is enabled.

I'm on 2.6.4 as 2.7 is unstable.

ghost commented 1 year ago

use 2.7 with addon patcher, cause of a changes inside the core of Skript the addon patcher will safelly remap those core elements and the olders things will works again perfect as expect.? otherwise try 2.8.6 i tried that on that and i don't got any errors

DaRealPilot commented 1 year ago

19:00:02 ERROR: #!#! [Skript] Severe Error: 19:00:02 ERROR: #!#! Error saving variable named playerdata::d6e06227-9593-4ee2-bmult

19:00:02 ERROR: #!#! Something went horribly wrong with Skript. 19:00:02 ERROR: #!#! This issue is NOT your fault! You probably can't fix it yourself, either. 19:00:02 ERROR: #!#! It looks like you are using some plugin(s) that alter how Skript works (addons). 19:00:02 ERROR: #!#! Following plugins are probably related to this error in some way: 19:00:02 ERROR: #!#! SkJson (https://github.com/SkJsonTeam/SkJson) 19:00:02 ERROR: #!#! You should try disabling those plugins one by one, trying to find which one causes it. 19:00:02 ERROR: #!#! If the error doesn't disappear even after disabling all listed plugins, it is probably Skript issue. 19:00:02 ERROR: #!#! In that case, you will be given instruction on how should you report it. 19:00:02 ERROR: #!#! On the other hand, if the error disappears when disabling some plugin, report it to author of that plugin. 19:00:02 ERROR: #!#! Only if the author tells you to do so, report it to Skript's issue tracker.

19:00:02 ERROR: #!#! Stack trace: 19:00:02 ERROR: #!#! ch.njol.skript.SkriptAPIException: Serializer of number must override newInstance(), canBeInstantiated() or mustSyncDeserialization() if its class does not have a nullary constructor 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.classes.Serializer.newInstance(Serializer.java:79) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.yggdrasil.Yggdrasil.newInstance(Yggdrasil.java:335) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.yggdrasil.Yggdrasil.isSerializable(Yggdrasil.java:154) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.yggdrasil.YggdrasilOutputStream.writeGenericObject(YggdrasilOutputStream.java:173) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.yggdrasil.YggdrasilOutputStream.writeObject(YggdrasilOutputStream.java:249) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.registrations.Classes.serialize(Classes.java:748) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.variables.Variables.serialize(Variables.java:812) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.variables.Variables.serialize(Variables.java:793) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.variables.Variables.saveVariableChange(Variables.java:822) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.variables.Variables.setVariable(Variables.java:543) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.variables.Variables.setVariable(Variables.java:526) 19:00:02 ERROR: #!#! at skJson-2.9.jar//cz.coffee.skjson.skript.base.JsonBase$MapJson.primitive(JsonBase.java:635) 19:00:02 ERROR: #!#! at skJson-2.9.jar//cz.coffee.skjson.skript.base.JsonBase$MapJson.lambda$toList$1(JsonBase.java:612) 19:00:02 ERROR: #!#! at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) 19:00:02 ERROR: #!#! at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) 19:00:02 ERROR: #!#! at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133) 19:00:02 ERROR: #!#! at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845) 19:00:02 ERROR: #!#! at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) 19:00:02 ERROR: #!#! at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) 19:00:02 ERROR: #!#! at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) 19:00:02 ERROR: #!#! at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) 19:00:02 ERROR: #!#! at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) 19:00:02 ERROR: #!#! at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) 19:00:02 ERROR: #!#! at skJson-2.9.jar//cz.coffee.skjson.skript.base.JsonBase$MapJson.toList(JsonBase.java:607) 19:00:02 ERROR: #!#! at skJson-2.9.jar//cz.coffee.skjson.skript.base.JsonBase$MapJson.execute(JsonBase.java:583) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.lang.Effect.run(Effect.java:50) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:62) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:90) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.lang.Trigger.execute(Trigger.java:52) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.lang.function.ScriptFunction.execute(ScriptFunction.java:86) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.lang.function.Function.execute(Function.java:129) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.lang.function.FunctionReference.execute(FunctionReference.java:301) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.lang.function.EffFunctionCall.execute(EffFunctionCall.java:52) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.lang.Effect.run(Effect.java:50) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:62) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:90) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.command.Commands.handleEffectCommand(Commands.java:222) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.command.Commands$2$1.call(Commands.java:316) 19:00:02 ERROR: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.command.Commands$2$1.call(Commands.java:313) 19:00:02 ERROR: #!#! at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftFuture.run(CraftFuture.java:88) 19:00:02 ERROR: #!#! at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:480) 19:00:02 ERROR: #!#! at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1480) 19:00:02 ERROR: #!#! at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:447) 19:00:02 ERROR: #!#! at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1394) 19:00:02 ERROR: #!#! at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1171) 19:00:02 ERROR: #!#! at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:318) 19:00:02 ERROR: #!#! at java.base/java.lang.Thread.run(Thread.java:833)

19:00:02 ERROR: #!#! Version Information: 19:00:02 ERROR: #!#! Skript: 2.7.0-beta3 19:00:02 ERROR: #!#! Flavor: skriptlang-github 19:00:02 ERROR: #!#! Date: 03:18:03.366646700 19:00:02 ERROR: #!#! Bukkit: 1.20.1-R0.1-SNAPSHOT 19:00:02 ERROR: #!#! Minecraft: 1.20.1 19:00:02 ERROR: #!#! Java: 17.0.7 (OpenJDK 64-Bit Server VM 17.0.7+7) 19:00:02 ERROR: #!#! OS: Linux amd64 5.19.0-43-generic

19:00:02 ERROR: #!#! Server platform: Paper

19:00:02 ERROR: #!#! Current node: null 19:00:02 ERROR: #!#! Current item: null

19:00:02 ERROR: #!#! Thread: Server thread

Tried using 2.7 with SkJson 2.9, got this error after trying to map it, It seems to open happen when I have a list such as: "pets": { "10": "1,0,250", "4323": "" },

But I need to be able to store the 10: and stuff. The 4323 makes it so that it saves as a list with indexes.

cooffeeRequired commented 1 year ago

Okey well, that is actually strange i tried everything And its. Works

cooffeeRequired commented 1 year ago

Can you provide the your envioroments

DaRealPilot commented 1 year ago

Its just on a minehut server, all its doing is mapping from that file image

.

cooffeeRequired commented 1 year ago

Where is addon patcher?

DaRealPilot commented 1 year ago

Appears to have not loaded. Give me a minute

DaRealPilot commented 1 year ago

Its enabled, it just doesn't show on /skript info

DaRealPilot commented 1 year ago

function Load(p: player): set {_json} to json from file "plugins/Skript/Json/%{_p}'s uuid%.json" loop values of {_json}: set {_key} to loop-value.keySet().toArray()[0] set {_value} to loop-value.values().toArray()[0] if "%class of {_value}%" = "cz.coffee.api.gson.JsonObject": set {_json} to json from string "%{_value}%" loop ...{_json}.keySet(): set {_finalValue} to "%{_json}.get(loop-value-2)%" set {PlayerData::%{_p}'s uuid%::%{_key}%::%loop-value-2%} to {_finalValue}.substring(1, {_finalValue}.length()-1) else: set {PlayerData::%{_p}'s uuid%::%{_key}%} to {_value}

Got it working with some weird reflect stuff, I was previously getting this though, if it helps. [19:46:59 ERROR]: #!#! ch.njol.skript.SkriptAPIException: Serializer of number must override newInstance(), canBeInstantiated() or mustSyncDeserialization() if its class does not have a nullary constructor [19:46:59 ERROR]: #!#! at Skript-2.7.0-beta3.jar//ch.njol.skript.classes.Serializer.newInstance(Serializer.java:79) [19:46:59 ERROR]: #!#! at Skript-2.7.0-beta3.jar//ch.njol.yggdrasil.Yggdrasil.newInstance(Yggdrasil.java:335) [19:46:59 ERROR]: #!#! at Skript-2.7.0-beta3.jar//ch.njol.yggdrasil.Yggdrasil.isSerializable(Yggdrasil.java:154) [19:46:59 ERROR]: #!#! at Skript-2.7.0-beta3.jar//ch.njol.yggdrasil.YggdrasilOutputStream.writeGenericObject(YggdrasilOutputStream.java:173) [19:46:59 ERROR]: #!#! at Skript-2.7.0-beta3.jar//ch.njol.yggdrasil.YggdrasilOutputStream.writeObject(YggdrasilOutputStream.java:249

ghost commented 1 year ago

i never seen the error tbh I'm gonna go investigate.

ghost commented 1 year ago

Can you send me all content from file? and actually I am also interested in what you want to achieve by using MAPPING?

ghost commented 1 year ago

i need to content of PlayerData::*

ghost commented 1 year ago

image That's completely right.

ghost commented 1 year ago

btw you don't need to mapping.

DaRealPilot commented 1 year ago

{ "mult": 1.5, "pets": { "4323": "test", "4325": "test" }, "plot": 0, "strength": 14.5, "vaultitems": { "4323": "test", "4325": "test" } } This is the updated one and this is the previous one below. { "mult": 1.75, "pets": { "10": "1,0,250", "4323": "" }, "plot": 0, "vaultitems": [ "" ] }

ghost commented 1 year ago

basically the parser takes it too aggressively and tries to make it a Bukkit Object which of course is not possible, i already fixing it give me max 30min. image

DaRealPilot commented 1 year ago

Ok cool thanks

ghost commented 1 year ago

But one question why do you using mapiing? why you dont go through values?

DaRealPilot commented 1 year ago

wdym in the reflect thing?

ghost commented 1 year ago

https://skjson.xyz/documentation/beta#expression-LoopExpression https://skjson.xyz/documentation/beta#expression-Elements

DaRealPilot commented 1 year ago

I tried looping elements it errored

ghost commented 1 year ago

can you show me how you did it?

ghost commented 1 year ago

because in terms of performance loop through json is much better than mapping and formatting

DaRealPilot commented 1 year ago

Oh I see what you mean, yeah I just didin't do that for some reason but I had an issue using this syntax: entr(y|ies) [%string%] of %object%

ghost commented 1 year ago

that no longer exist on the new version. It was fixed and Linked to 1 thing (value/values) json-key, json-value

ghost commented 1 year ago

Fixed :) image

on join:
    if json file "plugins/Skript/Json/%player's uuid%.json" does not exist:
        new json file "plugins/Skript/Json/%player's uuid%.json"
    Load(player)

on quit:
    Save(player, true)

every 3 minutes:
    loop all players:
        Save(loop-player)
        wait a second

function Save(p: player, b: boolean=false):
    set {_json} to {PlayerData::%{_p}'s uuid%::*}'s form
    send "&a=%{_json}%" to console
    write {_json} to json file "plugins/Skript/Json/%{_p}'s uuid%.json"
    if {_b} = true:
        delete {PlayerData::%{_p}'s uuid%::*}

function Load(p: player):
    set {_json} to json from file "plugins/Skript/Json/%{_p}'s uuid%.json"
    send "&b=%{_json}%" to console
    map {_json} to {PlayerData::%{_p}'s uuid%::*}

    send "&6=%{PlayerData::%{_p}'s uuid%::*}'s form%" to console

    # send "&6IN LOAD FROM JSON VAR: &f%{PlayerData::%{_p}'s uuid%::*}'s form%" to console

    # map {_json} to {_a::*}
    # loop indexes of {_a::*}:
    #     if {_a::%loop-value%} is set:
    #         set {PlayerData::%{_p}'s uuid%::%loop-value%} to "%{_a::%loop-value%}%"
    #         broadcast "%loop-value% | %{_a::%loop-value%}%"
    #     broadcast "%loop-value% | %{_a::%loop-value%}%"
    # broadcast "A::*"

command setPlayerData:
    trigger:
        set {PlayerData::%player's uuid%::mult} to 1.75
        set {PlayerData::%player's uuid%::pets::10} to "1,0,250"
        set {PlayerData::%player's uuid%::pets::4323} to ""
        set {PlayerData::%player's uuid%::plot} to 0
        set {PlayerData::%player's uuid%::vaultitems::*} to ""

        send {PlayerData::%player's uuid%::*}
        send {PlayerData::%player's uuid%::*}'s form to console
    https://skjson.xyz/download
    here you can find the fixed version, download gain the beta 2.9.jar
ghost commented 1 year ago

image