Restore inventory

  • 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 comminuty!

    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.
Jan 28, 2017
2
0
0
Hi everyone,

Skript 2.2-dev13
SkQuery 3.5.1 (or 3.21.4 sometimes)
Local server : spigot 1.10.2-R0.1-snapshot

I simply can not restore the inventory from this code :
code_language.skript:
command /test:
   trigger:
       set {Inv.%player%} to serialized contents of player's current inventory
       set {Inv.helmet.%player%} to player's helmet
       set {Inv.chestplate.%player%} to player's chestplate
       set {Inv.leggings.%player%} to player's leggings
       set {Inv.boots.%player%} to player's boots
       clear player's inventory
       wait 40 ticks
       set player's helmet to {Inv.helmet.%player%}
       set player's chestplate to {Inv.chestplate.%player%}
       set player's leggings to {Inv.leggings.%player%}
       set player's boots to {Inv.boots.%player%}
       restore inventory of player from {Inv.%player%}


I get the following error:
[14:52:12] [Server thread/ERROR]: #!#!
[14:52:12] [Server thread/ERROR]: #!#! [Skript] Severe Error:
[14:52:12] [Server thread/ERROR]: #!#!
[14:52:12] [Server thread/ERROR]: #!#! If you're developing an add-on for Skript this likely means that you have done something wrong.
[14:52:12] [Server thread/ERROR]: #!#! If you're a server admin however please go to http://dev.bukkit.org/server-mods/skript/tickets/
[14:52:12] [Server thread/ERROR]: #!#! and check whether this error has already been reported.
[14:52:12] [Server thread/ERROR]: #!#! If not please create a new ticket with a meaningful title, copy & paste this whole error into it,
[14:52:12] [Server thread/ERROR]: #!#! and describe what you did before it happened and/or what you think caused the error.
[14:52:12] [Server thread/ERROR]: #!#! If you think that it's a trigger that's causing the error please post the trigger as well.
[14:52:12] [Server thread/ERROR]: #!#! By following this guide fixing the error should be easy and done fast.
[14:52:12] [Server thread/ERROR]: #!#!
[14:52:12] [Server thread/ERROR]: #!#! Stack trace:
[14:52:12] [Server thread/ERROR]: #!#! java.lang.IllegalArgumentException: Chests must have a size that is a multiple of 9!
[14:52:12] [Server thread/ERROR]: #!#! at org.apache.commons.lang.Validate.isTrue(Validate.java:136)
[14:52:12] [Server thread/ERROR]: #!#! at org.bukkit.craftbukkit.v1_10_R1.CraftServer.createInventory(CraftServer.java:1526)
[14:52:12] [Server thread/ERROR]: #!#! at com.w00tmast3r.skquery.util.serialization.InventorySerialUtils.fromBase64(InventorySerialUtils.java:34)
[14:52:12] [Server thread/ERROR]: #!#! at com.w00tmast3r.skquery.elements.effects.EffDeserializeReturn.execute(EffDeserializeReturn.java:28)
[14:52:12] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.Effect.run(Effect.java:54)
[14:52:12] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:63)
[14:52:12] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:91)
[14:52:12] [Server thread/ERROR]: #!#! at ch.njol.skript.effects.Delay$1.run(Delay.java:84)
[14:52:12] [Server thread/ERROR]: #!#! at org.bukkit.craftbukkit.v1_10_R1.scheduler.CraftTask.run(CraftTask.java:71)
[14:52:12] [Server thread/ERROR]: #!#! at org.bukkit.craftbukkit.v1_10_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:353)
[14:52:12] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_10_R1.MinecraftServer.D(MinecraftServer.java:723)
[14:52:12] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_10_R1.DedicatedServer.D(DedicatedServer.java:400)
[14:52:12] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_10_R1.MinecraftServer.C(MinecraftServer.java:668)
[14:52:12] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_10_R1.MinecraftServer.run(MinecraftServer.java:567)
[14:52:12] [Server thread/ERROR]: #!#! at java.lang.Thread.run(Unknown Source)
[14:52:12] [Server thread/ERROR]: #!#!
[14:52:12] [Server thread/ERROR]: #!#! Version Information:
[14:52:12] [Server thread/ERROR]: #!#! Skript: 2.2-dev13
[14:52:12] [Server thread/ERROR]: #!#! Bukkit: 1.10.2-R0.1-SNAPSHOT
[14:52:12] [Server thread/ERROR]: #!#! Minecraft: 1.10.2
[14:52:12] [Server thread/ERROR]: #!#! Java: 1.8.0_121 (Java HotSpot(TM) 64-Bit Server VM 25.121-b13)
[14:52:12] [Server thread/ERROR]: #!#! OS: Windows 7 amd64 6.1
[14:52:12] [Server thread/ERROR]: #!#!
[14:52:12] [Server thread/ERROR]: #!#! Running CraftBukkit: false
[14:52:12] [Server thread/ERROR]: #!#!
[14:52:12] [Server thread/ERROR]: #!#! Current node: null
[14:52:12] [Server thread/ERROR]: #!#! Current item: deserialize return
[14:52:12] [Server thread/ERROR]: #!#!
[14:52:12] [Server thread/ERROR]: #!#! Thread: Server thread
[14:52:12] [Server thread/ERROR]: #!#!
[14:52:12] [Server thread/ERROR]: #!#! End of Error.
[14:52:12] [Server thread/ERROR]: #!#!

Do you have a solution for me ?
 
[14:52:12] [Server thread/ERROR]: #!#! java.lang.IllegalArgumentException: Chests must have a size that is a multiple of 9!

This might have something to do with it? Maybe another part of your skript? Unless you have to save the steralized inventory of a player to a list variable not to sure.. never used it before.

code_language.skript:
 set {Inv::%uuid of player%::*} to serialized contents of player's current inventory

try that
 
I'll try that, but I also have to put the variable list on ? :
code_language.skript:
restore inventory of player from {Inv::%uuid of player::*}

EDIT: So I have no more errors but I still do not have inventory restored.
code_language.skript:
command /test:
   trigger:
       set {Inv::%player%::*} to serialized contents of player's current inventory
       set {Inv.helmet.%player%} to player's helmet
       set {Inv.chestplate.%player%} to player's chestplate
       set {Inv.leggings.%player%} to player's leggings
       set {Inv.boots.%player%} to player's boots
       clear player's inventory
       wait 40 ticks
       set player's helmet to {Inv.helmet.%player%}
       set player's chestplate to {Inv.chestplate.%player%}
       set player's leggings to {Inv.leggings.%player%}
       set player's boots to {Inv.boots.%player%}
       restore inventory of player from {Inv::%player%}

EDIT2:
with
code_language.skript:
       loop {Inv::%uuid of player%::*}:
           message "%loop-value%"
I always get the same value regardless of the object in the inventory
rO0ABXcEAAAABXBwcHBw
 
Last edited by a moderator:
Status
Not open for further replies.