Aller au contenu
  • 0

Sauvegarder le bouclier


Question

Posté(e)

Minecraft: Spigot 1.11.2

Skript: dev29

 

Bonjour, je veux sauvegarder l'inventaire, et le stuff de mes joueurs.

 

J'utilise donc naturellement:

set {_count} to 0
               loop 36 times:
                   set {invsurvival.%UUID of player%.%{_count}%} to slot {_count} of player's inventory
                   add 1 to {_count}
           wait 2 tick
           set {invsurvival.%uuid of player%.casque} to helmet of player
           set {invsurvival.%uuid of player%.plastron} to chestplate of player
           set {invsurvival.%uuid of player%.pantalon} to leggings of player
           set {invsurvival.%uuid of player%.bottes} to boots of player

 

Sauf que je ne connais pas la ligne pour pouvoir sauvegarder l'emplacement du bouclier (ou de la deuxième main, c'est pareil)

 

Merci ! :D

14 réponses à cette question

Messages recommandés

  • 0
Posté(e)

Oulalalala, ta manière de sauvegarder les inventaires est dépassée !

Maintenant on utilise les "serialized inventory"

 

En gros au lieu de loop tout son inventaire, tu fais simplement

set {lenomdetavariable} to player's serialized inventory
#Ici, c'est pour sauvegarder l'inventaire COMPLET (sauf armures) dans la variable


restore inventory of player from {lenomdetavariable}
#Et ici, c'est pour remplacer l'inventaire actuel du  joueur par celui qu'on a sauvegardé.

 

Cependant, si tu veux sauvegarder les armures, utilise bien les 4 autres lignes, car les inventaires sérialisés ne sont pas capables de sauvegarder l'armure.

 

NOTE: Je ne sais pas si les inventaires sérialisés permettent de sauvegarder la seconde main, mais au moins, ça pourrai optimiser ton code.

Et si c'est le cas, passe ton post en résolu ;)

  • 0
Posté(e)

quand le "restore inventory of player from {equips}" s'éxécute, sa me dit "An internal error occurred while attemting to perform this command"

  • 0
Posté(e)
quand le "restore inventory of player from {equips}" s'éxécute, sa me dit "An internal error occurred while attemting to perform this command"

 

Si tu reçois ce message, tu as forcément une erreur dans la CONSOLE.

Si tu peux me copier l'erreur, je pourrai peut-être t'aider.

  • 0
Posté(e)
[23:35:53] [server thread/ERROR]: #!#!
[23:35:53] [server thread/ERROR]: #!#! [skript] Severe Error:
[23:35:53] [server thread/ERROR]: #!#!
[23:35:53] [server thread/ERROR]: #!#! If you're developing an add-on for Skript this likely means that you have done something wrong.
[23:35:53] [server thread/ERROR]: #!#! If you're a server admin however please go to https://github.com/bensku/Skript/issues/
[23:35:53] [server thread/ERROR]: #!#! and check whether this error has already been reported.
[23:35:53] [server thread/ERROR]: #!#! If not please create a new ticket with a meaningful title, copy & paste this whole error into it (or use paste service),
[23:35:53] [server thread/ERROR]: #!#! and describe what you did before it happened and/or what you think caused the error.
[23:35:53] [server thread/ERROR]: #!#! If you think that it's a trigger that's causing the error please post the trigger as well.
[23:35:53] [server thread/ERROR]: #!#! By following this guide fixing the error should be easy and done fast.
[23:35:53] [server thread/ERROR]: #!#!
[23:35:53] [server thread/ERROR]: #!#! Stack trace:
[23:35:53] [server thread/ERROR]: #!#! java.lang.IllegalArgumentException: Chests must have a size that is a multiple of 9!
[23:35:53] [server thread/ERROR]: #!#!     at org.apache.commons.lang.Validate.isTrue(Validate.java:136)
[23:35:53] [server thread/ERROR]: #!#!     at org.bukkit.craftbukkit.v1_11_R1.CraftServer.createInventory(CraftServer.java:1524)
[23:35:53] [server thread/ERROR]: #!#!     at com.w00tmast3r.skquery.util.serialization.InventorySerialUtils.fromBase64(InventorySerialUtils.java:34)
[23:35:53] [server thread/ERROR]: #!#!     at com.w00tmast3r.skquery.elements.effects.EffDeserializeReturn.execute(EffDeserializeReturn.java:28)
[23:35:53] [server thread/ERROR]: #!#!     at ch.njol.skript.lang.Effect.run(Effect.java:52)
[23:35:53] [server thread/ERROR]: #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61)
[23:35:53] [server thread/ERROR]: #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89)
[23:35:53] [server thread/ERROR]: #!#!     at ch.njol.skript.lang.Trigger.execute(Trigger.java:55)
[23:35:53] [server thread/ERROR]: #!#!     at ch.njol.skript.command.ScriptCommand.execute2(ScriptCommand.java:220)
[23:35:53] [server thread/ERROR]: #!#!     at ch.njol.skript.command.ScriptCommand.execute(ScriptCommand.java:182)
[23:35:53] [server thread/ERROR]: #!#!     at ch.njol.skript.command.Commands.handleCommand(Commands.java:268)
[23:35:53] [server thread/ERROR]: #!#!     at ch.njol.skript.command.Commands$1.onPlayerCommand(Commands.java:163)
[23:35:53] [server thread/ERROR]: #!#!     at sun.reflect.GeneratedMethodAccessor644.invoke(Unknown Source)
[23:35:53] [server thread/ERROR]: #!#!     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[23:35:53] [server thread/ERROR]: #!#!     at java.lang.reflect.Method.invoke(Method.java:497)
[23:35:53] [server thread/ERROR]: #!#!     at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302)
[23:35:53] [server thread/ERROR]: #!#!     at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
[23:35:53] [server thread/ERROR]: #!#!     at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502)
[23:35:53] [server thread/ERROR]: #!#!     at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487)
[23:35:53] [server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.PlayerConnection.handleCommand(PlayerConnection.java:1346)
[23:35:53] [server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.PlayerConnection.a(PlayerConnection.java:1189)
[23:35:53] [server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.PacketPlayInChat.a(PacketPlayInChat.java:45)
[23:35:53] [server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.PacketPlayInChat.a(PacketPlayInChat.java:1)
[23:35:53] [server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.PlayerConnectionUtils$1.run(SourceFile:13)
[23:35:53] [server thread/ERROR]: #!#!     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[23:35:53] [server thread/ERROR]: #!#!     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[23:35:53] [server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.SystemUtils.a(SourceFile:46)
[23:35:53] [server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.MinecraftServer.D(MinecraftServer.java:747)
[23:35:53] [server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:399)
[23:35:53] [server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:678)
[23:35:53] [server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:576)
[23:35:53] [server thread/ERROR]: #!#!     at java.lang.Thread.run(Thread.java:745)
[23:35:54] [server thread/ERROR]: #!#!
[23:35:54] [server thread/ERROR]: #!#! Version Information:
[23:35:54] [server thread/ERROR]: #!#!   Skript: 2.2-dev27
[23:35:54] [server thread/ERROR]: #!#!   Bukkit: 1.11.2-R0.1-SNAPSHOT
[23:35:54] [server thread/ERROR]: #!#!   Minecraft: 1.11.2
[23:35:54] [server thread/ERROR]: #!#!   Java: 1.8.0_60 (Java HotSpot(TM) 64-Bit Server VM 25.60-b23)
[23:35:54] [server thread/ERROR]: #!#!   OS: Linux amd64 3.5.0-47-generic
[23:35:54] [server thread/ERROR]: #!#!
[23:35:54] [server thread/ERROR]: #!#! Running CraftBukkit: false
[23:35:54] [server thread/ERROR]: #!#!
[23:35:54] [server thread/ERROR]: #!#! Current node: null
[23:35:54] [server thread/ERROR]: #!#! Current item: deserialize return
[23:35:54] [server thread/ERROR]: #!#!
[23:35:54] [server thread/ERROR]: #!#! Thread: Server thread
[23:35:54] [server thread/ERROR]: #!#!
[23:35:54] [server thread/ERROR]: #!#! End of Error.
[23:35:54] [server thread/ERROR]: #!#! 

  • 0
Posté(e)

En fait la méthode ne fonctionne pas car justement, tu as un slot en plus, et dans l'erreur, ils te disent "

java.lang.IllegalArgumentException: Chests must have a size that is a multiple of 9!"

Ce qui veut donc dire que l'inventaire doit être un multiple de 9, ce qui ne l'est pas car tu as un slot en plus.

Donc pour le coup, je sais pas comment je peux t'aider :(

  • 0
Posté(e)

après décompilation, il semblerais qu'il n'ai pas prevue de nom pour l'emplacement du bouclier.

mais j'ai trouvé un élémént qui correspond a la doc du bukkit https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/EntityEquipment.html

 

le " getItemInOffHand() " qui dans Skript 2.2 dev-29 correspond a " OFF_HAND "

 

peut être que " the off_hand of player's "

peut

fonctionné

 

je testerais dans l'après midi.

 

Edit ------------------------------------------------------------------------------------------

Voila après recherche et Test c'est " off hand tool " ou " offhand tool " qu'il faut utiliser, quand au numero de slot il semblerais que ce soit le N° 40

 

Voila un bout de code qui a tres bien fonctioné pour moi

Serveur : Spigot 1.11.2-R0.1

Skript : 2.2-dev29

Addon : Aucun

command /hand:
   trigger:
       message "1 : %offhand tool of player%"
       wait 2 seconds
       set offhand tool of player to torch
       enchant the player's offhand tool with projectile protection 5
       message "2 : %off hand tool of player%"
       wait 2 seconds
       set offhand tool of player to stone
       message "3 : %slot 40 of player%"

 

 

  • J'aime 1
  • 0
Posté(e)
après décompilation, il semblerais qu'il n'ai pas prevue de nom pour l'emplacement du bouclier.

mais j'ai trouvé un élémént qui correspond a la doc du bukkit https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/EntityEquipment.html

 

le " getItemInOffHand() " qui dans Skript 2.2 dev-29 correspond a " OFF_HAND "

 

peut être que " the off_hand of player's "

peut

fonctionné

 

je testerais dans l'après midi.

 

Edit ------------------------------------------------------------------------------------------

 

Voila après recherche et Test c'est " off hand tool " ou " offhand tool " qu'il faut utiliser, quand au numero de slot il semblerais que ce soit le N° 40

 

Voila un bout de code qui a tres bien fonctioné pour moi

Serveur : Spigot 1.11.2-R0.1

Skript : 2.2-dev29

Addon : Aucun

command /hand:
   trigger:
       message "1 : %offhand tool of player%"
       wait 2 seconds
       set offhand tool of player to torch
       enchant the player's offhand tool with projectile protection 5
       message "2 : %off hand tool of player%"
       wait 2 seconds
       set offhand tool of player to stone
       message "3 : %slot 40 of player%"

 

Merci beaucoup c'est super :=)

×
×
  • Créer...

Information importante

Nous avons placé des cookies sur votre appareil pour aider à améliorer ce site. Vous pouvez choisir d’ajuster vos paramètres de cookie, sinon nous supposerons que vous êtes d’accord pour continuer.