1. 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!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

skUtilities Reading, Writing and Deleting YAML

Discussion in 'Tutorials' started by TonyMaster21, Jan 11, 2017.

  1. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,055
    Likes Received:
    144
    ok
     
    • Funny Funny x 1
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,055
    Likes Received:
    144
    This has been solved in Discord.
     
  3. BrettPlayMC

    Supporter

    Joined:
    Jan 26, 2017
    Messages:
    711
    Likes Received:
    53
    Is there any way to check if a yaml value is set?
     
  4. itismejoey

    Retired Staff VIP

    Joined:
    Nov 28, 2016
    Messages:
    122
    Likes Received:
    30
    Yes.

    :emoji_wave:
     
  5. KingAlterIV

    KingAlterIV Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    98
    Likes Received:
    16
    Oh hai Joey. :emoji_wave::emoji_wave:
     
    • Like Like x 1
  6. AngelGamer29ja

    Joined:
    Jan 28, 2018
    Messages:
    4
    Likes Received:
    0
    As ago to add a line to the list
     
  7. J

    Juan7030 Member

    Joined:
    Mar 20, 2017
    Messages:
    13
    Likes Received:
    0
    How can i create a scoreboard configurable with this?
     
  8. sOxTw

    sOxTw Active Member

    Joined:
    Jan 27, 2017
    Messages:
    34
    Likes Received:
    2
    I am in need of help with a problem regarding this thread.

    My problem is that I need to remove a node from a YAML file which contains enchantments of an item taken from a user's inventory.

    My code:
    Code (Text):
    1. loop 36 times:
    2.     set {_Save} to slot {_count} of {_p}'s inventory
    3.     set yaml value "Slot-%{_count}%" from "../../SaveKits/userdata/%{_p}'s uuid%/File-%{_s}%/Inventory/Slot-%{_count}%.yml" to {_Save}
    With this code I save the item in slot 0 of the owner and then show it in this section.
    Code (Text):
    1. open chest with 5 rows named {@NameSaveLoadMenu} to {_p}
    2.     wait 1 tick
    3.    
    4.     # Slot 1
    5.     if skutil dir "plugins/SaveKits/userdata/%{_p}'s uuid%/File-1" exists:
    6.     set {_Icon-1} to skutil yaml value "Icon" from file "plugins/SaveKits/userdata/%{_p}'s uuid%/File-1/Icon.yml"
    7.     format slot 9 of {_p} with {_Icon-1} named "&cKit 1" with lore "&7Para guardar tu inventario||&7presiona aqui.||||&c&l¡Eliminaras el inventario guardado!" to close then run [SaveKits({_p}, 1)]
    8.     else:
    9.         format slot 9 of {_p} with stained glass pane:14 named "&aSlot 1 Disponible" with lore "&7Para guardar tu inventario||&7presiona aqui." to close then run [SaveKits({_p}, 1)]
    When saving the file I am sorted the information in this way:
    Code (Text):
    1. Icon:
    2.   ==: org.bukkit.inventory.ItemStack
    3.   type: DIAMOND_SWORD
    4.   meta:
    5.     ==: ItemMeta
    6.     meta-type: UNSPECIFIC
    7.     enchants:
    8.       DAMAGE_ALL: 2
    9.  
    But I need to remove the enchantments.
    It should look like this

    Code (Text):
    1. Icon:
    2.   ==: org.bukkit.inventory.ItemStack
    3.   type: DIAMOND_SWORD
    4.   meta:
    5.     ==: ItemMeta
    6.     meta-type: UNSPECIFIC
    7.  
    Eh tried with this code but it doesn't work. And I can't think of another way.
    Code (Text):
    1. delete skutil yaml nodes "Icon.meta.enchants" from file "plugins/SaveKits/userdata/%{_p}'s uuid%/File-%{_s}%/Icon.yml"        
    Does anyone know how to save the name of the item without the enchantments or how to remove that section of code without destroying the information on it?
     
Loading...