skUtilities Reading, Writing and Deleting YAML

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

I only need anyone to help me with a little issue I'm having. That doesn't mean the premium resource is not mine, couse it has more than 1500 lines, and the part that I've posted here only ocupated 20 lines.

Although, you are right, I have a free resource and now I'm coding the paid version with YML, among many other thinhgs, because it's not funny to lose all your configuration options on every plugin update where a skript config value changes.

If you don't wanna help me, don't do it.
ok
 
Hi, I need help!

code:
code_language.skript:
on load:
    file "plugins\SuperBans\config.yml" doesn't exist:
        create file "plugins\SuperBans\config.yml"
    skutil yaml path "messages.ban_screen_message" in file "plugins\SuperBans\config.yml" doesn't exist:
        set skutil yaml value "messages.ban_screen_message" from file "plugins\SuperBans\config.yml" to ""
        add "&7Sadly, you were &cBanned &7from &6ServerName&7. Apply on our forums if you want to dispute your ban!" to skutil yaml list "messages.ban_screen_message" from file "plugins\SuperBans\config.yml"
        add "" to skutil yaml list "messages.ban_screen_message" from file "plugins\SuperBans\config.yml"
        add "" to skutil yaml list "messages.ban_screen_message" from file "plugins\SuperBans\config.yml"
        add "&7Banned by: &a%{sban.bannedby.%{_p}%}%" to skutil yaml list "messages.ban_screen_message" from file "plugins\SuperBans\config.yml"
        add "" to skutil yaml list "messages.ban_screen_message" from file "plugins\SuperBans\config.yml"
        add "" to skutil yaml list "messages.ban_screen_message" from file "plugins\SuperBans\config.yml"
        add "&7Banned on: &c%{sban.bannedon.%{_p}%}%" to skutil yaml list "messages.ban_screen_message" from file "plugins\SuperBans\config.yml"
        add "" to skutil yaml list "messages.ban_screen_message" from file "plugins\SuperBans\config.yml"
        add "&7Autounban: &c%{sban.banexpire.%{_p}%}%" to skutil yaml list "messages.ban_screen_message" from file "plugins\SuperBans\config.yml"
        add "" to skutil yaml list "messages.ban_screen_message" from file "plugins\SuperBans\config.yml"
        add "&7IP Banned: &c%{sban.banip.%{_p}%}%" to skutil yaml list "messages.ban_screen_message" from file "plugins\SuperBans\config.yml"
        add "" to skutil yaml list "messages.ban_screen_message" from file "plugins\SuperBans\config.yml"
        add "&7Reason: &c%{sban.banreason.%{_p}%}%" to skutil yaml list "messages.ban_screen_message" from file "plugins\SuperBans\config.yml"
        add "" to skutil yaml list "messages.ban_screen_message" from file "plugins\SuperBans\config.yml"
        add "" to skutil yaml list "messages.ban_screen_message" from file "plugins\SuperBans\config.yml"
        add "&eBuy an unban &8» &cwww.yourserver.buycraft.net" to skutil yaml list "messages.ban_screen_message" from file "plugins\SuperBans\config.yml"
        add "" to skutil yaml list "messages.ban_screen_message" from file "plugins\SuperBans\config.yml"
        add "&eForums to apply &8» &cwww.yourserver.net" to skutil yaml list "messages.ban_screen_message" from file "plugins\SuperBans\config.yml"
    set {superbans::messages::ban_screen_message::*} to yml list "messages.ban_screen_message" of file "plugins\SuperBans\config.yml"

But when using {superbans::messages::ban_screen_message::*} the message is displayed with commas, and I want it to be displayed with spaces. And also, the variables are writed to the file like <none>

This has been solved in Discord.
 
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:
loop 36 times:
    set {_Save} to slot {_count} of {_p}'s inventory
    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:
open chest with 5 rows named {@NameSaveLoadMenu} to {_p}
    wait 1 tick
    
    # Slot 1
    if skutil dir "plugins/SaveKits/userdata/%{_p}'s uuid%/File-1" exists:
    set {_Icon-1} to skutil yaml value "Icon" from file "plugins/SaveKits/userdata/%{_p}'s uuid%/File-1/Icon.yml"
    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)]
    else:
        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:
Icon:
  ==: org.bukkit.inventory.ItemStack
  type: DIAMOND_SWORD
  meta:
    ==: ItemMeta
    meta-type: UNSPECIFIC
    enchants:
      DAMAGE_ALL: 2

But I need to remove the enchantments.
It should look like this

Code:
Icon:
  ==: org.bukkit.inventory.ItemStack
  type: DIAMOND_SWORD
  meta:
    ==: ItemMeta
    meta-type: UNSPECIFIC

Eh tried with this code but it doesn't work. And I can't think of another way.
Code:
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?