Bonjour j'ai crée un système de kit avec un fichier YAML mais si je mes un item avec un nom random sa ne veut plus me give l'item.
Le skript:
command kit <text> [<text>]:
permission: yaml.kit
trigger:
#Editing a yml file has sometimes cleared the entire yaml for me.
#Haven't pinpointed the issue, but I think it has to do with improperly setting a list
if arg-1 is "new" or "add":
if arg-2 is not set:
send "Missing name! /kit new <Name>"
else:
#setting value
set yaml value "kits.%arg-2%.enabled" from file "example.yml" to true
loop all items in player's inventory:
loop-item is not air
add "%loop-item%" to {_tempkit::*}
loop {_tempkit::*}:
#setting list
add loop-value to yaml list "kits.%arg-2%.items" from file "example.yml"
send "Kit created!"
else if arg-1 is "enable" or "disable":
set {_exists} to yaml value "kits.%arg-2%.enabled" from file "example.yml"
{_exists} is set:
if arg-1 is "enable":
#setting value
set yaml value "kits.%arg-2%.enabled" from file "example.yml" to true
send "Enabled kit %arg-2%"
else:
#setting value
set yaml value "kits.%arg-2%.enabled" from file "example.yml" to false
send "Disabled kit %arg-2%"
else:
send "This kit was not found"
else if arg-1 is "display" or "all":
if arg-2 is "-detail":
#reading nodes with keys
set {_nodes::*} to yaml nodes with keys "kits" from file "example.yml"
loop {_nodes::*}:
#reading value
set {_expand::%loop-value%} to yaml value "kits.%loop-value%" from file "example.yml"
loop {_expand::*}:
send "%loop-index%: %loop-value%"
else:
#reading nodes
set {_nodes::*} to yaml nodes "kits" from file "example.yml"
loop {_nodes::*}:
#reading value
yaml value "kits.%loop-value%.enabled" from file "example.yml" is not true
delete {_nodes::%loop-index%}
send {_nodes::*}
else:
#reading value
set {_enabled} to yaml value "kits.%arg-1%.enabled" from file "example.yml"
if {_enabled} is true:
#reading list
set {_kits::*} to yaml list "kits.%arg-1%.items" from file "example.yml"
loop {_kits::*}:
set {_kits::%loop-index%} to loop-value parsed as item types
give player {_kits::*}
else if {_enabled} is false:
send "This kit is disabled."
else:
send "This kit doesn't exist!%nl%Use /kit display -detail"
le fichier YAML:
kits:
yolo2:
enabled: true
items:
- golden chestplate
- diamond boots
- iron leggings
- chainmail boots
- 64 grass
- diamond sword of Sharpness 5 named "§4§lYolo"
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.
Question
lexmad13009
Bonjour j'ai crée un système de kit avec un fichier YAML mais si je mes un item avec un nom random sa ne veut plus me give l'item.
Le skript:
command kit <text> [<text>]: permission: yaml.kit trigger: #Editing a yml file has sometimes cleared the entire yaml for me. #Haven't pinpointed the issue, but I think it has to do with improperly setting a list if arg-1 is "new" or "add": if arg-2 is not set: send "Missing name! /kit new <Name>" else: #setting value set yaml value "kits.%arg-2%.enabled" from file "example.yml" to true loop all items in player's inventory: loop-item is not air add "%loop-item%" to {_tempkit::*} loop {_tempkit::*}: #setting list add loop-value to yaml list "kits.%arg-2%.items" from file "example.yml" send "Kit created!" else if arg-1 is "enable" or "disable": set {_exists} to yaml value "kits.%arg-2%.enabled" from file "example.yml" {_exists} is set: if arg-1 is "enable": #setting value set yaml value "kits.%arg-2%.enabled" from file "example.yml" to true send "Enabled kit %arg-2%" else: #setting value set yaml value "kits.%arg-2%.enabled" from file "example.yml" to false send "Disabled kit %arg-2%" else: send "This kit was not found" else if arg-1 is "display" or "all": if arg-2 is "-detail": #reading nodes with keys set {_nodes::*} to yaml nodes with keys "kits" from file "example.yml" loop {_nodes::*}: #reading value set {_expand::%loop-value%} to yaml value "kits.%loop-value%" from file "example.yml" loop {_expand::*}: send "%loop-index%: %loop-value%" else: #reading nodes set {_nodes::*} to yaml nodes "kits" from file "example.yml" loop {_nodes::*}: #reading value yaml value "kits.%loop-value%.enabled" from file "example.yml" is not true delete {_nodes::%loop-index%} send {_nodes::*} else: #reading value set {_enabled} to yaml value "kits.%arg-1%.enabled" from file "example.yml" if {_enabled} is true: #reading list set {_kits::*} to yaml list "kits.%arg-1%.items" from file "example.yml" loop {_kits::*}: set {_kits::%loop-index%} to loop-value parsed as item types give player {_kits::*} else if {_enabled} is false: send "This kit is disabled." else: send "This kit doesn't exist!%nl%Use /kit display -detail"le fichier YAML:
6 réponses à cette question
Messages recommandés