How to create a yaml file like mine with skript-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!

KroterPvP

Active Member
Apr 10, 2017
178
7
18
22
As there is a new addon to handle yaml files (skript-yaml) in a new way that doesn't affect to server performance, I decided to update all the yaml files of my SuperBans skript. I experimented with some of the expressions but I can't create create the file like the one below.

Code that works, but using SkUtilities:
code_language.skript:
on load:
    file "plugins\SuperBans\config.yml" doesn't exist:
        create file "plugins\SuperBans\config.yml"
        set skutil yaml value "PUNISHMENTS.Notification-Type" from file "plugins\SuperBans\config.yml" to "1"
        set skutil yaml value "PUNISHMENTS.Console-Notifications" from file "plugins\SuperBans\config.yml" to "true"
        set skutil yaml value "PUNISHMENTS.Show-Leave-Message" from file "plugins\SuperBans\config.yml" to "false"
        set skutil yaml value "PUNISHMENTS.Max-Warns" from file "plugins\SuperBans\config.yml" to "4"
        set skutil yaml value "GUI.Unban-Messages" from file "plugins\SuperBans\config.yml" to "true"
        set skutil yaml value "GUI.Keep-Open" from file "plugins\SuperBans\config.yml" to "true"
        set skutil yaml value "GUI.Silent" from file "plugins\SuperBans\config.yml" to "false"
        set skutil yaml value "SERVER.Name" from file "plugins\SuperBans\config.yml" to "Server Name"
        set skutil yaml value "SERVER.Shop" from file "plugins\SuperBans\config.yml" to "https://mc.yourserver.com/shop"
        set skutil yaml value "SERVER.Web" from file "plugins\SuperBans\config.yml" to "https://mc.yourserver.com/formum"
        set skutil yaml value "DISALLOWED.COMMANDS.While-Frozen" from file "plugins\SuperBans\config.yml" to ""
        add "spawn" to skutil yaml list "DISALLOWED.COMMANDS.While-Frozen" from file "plugins\SuperBans\config.yml"
        add "warp" to skutil yaml list "DISALLOWED.COMMANDS.While-Frozen" from file "plugins\SuperBans\config.yml"
        add "home" to skutil yaml list "DISALLOWED.COMMANDS.While-Frozen" from file "plugins\SuperBans\config.yml"
        add "tpa" to skutil yaml list "DISALLOWED.COMMANDS.While-Frozen" from file "plugins\SuperBans\config.yml"
        set skutil yaml value "DISALLOWED.COMMANDS.While-Muted" from file "plugins\SuperBans\config.yml" to ""
        add "tell" to skutil yaml list "DISALLOWED.COMMANDS.While-Muted" from file "plugins\SuperBans\config.yml"
        add "msg" to skutil yaml list "DISALLOWED.COMMANDS.While-Muted" from file "plugins\SuperBans\config.yml"
        add "me" to skutil yaml list "DISALLOWED.COMMANDS.While-Muted" from file "plugins\SuperBans\config.yml"
        set skutil yaml value "ANTISWEAR.Enabled" from file "plugins\SuperBans\config.yml" to "true"
        set skutil yaml value "ANTISWEAR.Word-Replacer" from file "plugins\SuperBans\config.yml" to "*"
        set skutil yaml value "ANTISWEAR.WORDS" from file "plugins\SuperBans\config.yml" to ""
        add "fuck" to skutil yaml list "ANTISWEAR.WORDS" from file "plugins\SuperBans\config.yml"
        add "dick" to skutil yaml list "ANTISWEAR.WORDS" from file "plugins\SuperBans\config.yml"
        add "cunt" to skutil yaml list "ANTISWEAR.WORDS" from file "plugins\SuperBans\config.yml"
        set skutil yaml value "MAIN.File-Name" from file "plugins\SuperBans\config.yml" to "SuperBans"
        set skutil yaml value "MAIN.Check-For-Updates" from file "plugins\SuperBans\config.yml" to "true"

        write "## This will be the type of notification sent on new punishments. Valid values are: '1' for messages, '2' for actionbars." at line 2 to file "plugins\SuperBans\config.yml"
        write "" at line 7 to file "plugins\SuperBans\config.yml"
        write "" at line 12 to file "plugins\SuperBans\config.yml"
        write "" at line 17 to file "plugins\SuperBans\config.yml"
        write "" at line 29 to file "plugins\SuperBans\config.yml"
        write "" at line 37 to file "plugins\SuperBans\config.yml"        set {OPTIONS::PUNISHMENTS::Notification-Type} to yml value "PUNISHMENTS.Notification-Type" of file "plugins\SuperBans\config.yml"
    set {OPTIONS::PUNISHMENTS::Console-Notifications} to yml value "PUNISHMENTS.Console-Notifications" of file "plugins\SuperBans\config.yml"
    set {OPTIONS::PUNISHMENTS::Show-Leave-Message} to yml value "PUNISHMENTS.Show-Leave-Message" of file "plugins\SuperBans\config.yml"
    set {OPTIONS::PUNISHMENTS::Max-Warns} to yml value "PUNISHMENTS.Max-Warns" of file "plugins\SuperBans\config.yml"
    set {OPTIONS::GUI::Unban-Messages} to yml value "GUI.Unban-Messages" of file "plugins\SuperBans\config.yml"
    set {OPTIONS::GUI::Keep-Open} to yml value "GUI.Keep-Open" of file "plugins\SuperBans\config.yml"
    set {OPTIONS::GUI::Silent} to yml value "GUI.Silent" of file "plugins\SuperBans\config.yml"
    set {OPTIONS::SERVER::Name} to yml value "SERVER.Name" of file "plugins\SuperBans\config.yml"
    set {OPTIONS::SERVER::Shop} to yml value "SERVER.Shop" of file "plugins\SuperBans\config.yml"
    set {OPTIONS::SERVER::Web} to yml value "SERVER.Web" of file "plugins\SuperBans\config.yml"
    set {OPTIONS::DISALLOWED::COMMANDS::While-Frozen::*} to yml list "DISALLOWED.COMMANDS.While-Frozen" of file "plugins\SuperBans\config.yml"
    set {OPTIONS::DISALLOWED::COMMANDS::While-Muted::*} to yml list "DISALLOWED.COMMANDS.While-Muted" of file "plugins\SuperBans\config.yml"
    set {OPTIONS::ANTISWEAR::Enabled} to yml value "ANTISWEAR.Enabled" of file "plugins\SuperBans\config.yml"
    set {OPTIONS::ANTISWEAR::Word-Replacer} to yml value "ANTISWEAR.Word-Replacer" of file "plugins\SuperBans\config.yml"
    set {OPTIONS::ANTISWEAR::WORDS::*} to yml list "ANTISWEAR.WORDS" of file "plugins\SuperBans\config.yml"
    set {OPTIONS::MAIN::File-Name} to yml value "MAIN.File-Name" of file "plugins\SuperBans\config.yml"
    set {OPTIONS::MAIN::Check-For-Updates} to yml value "MAIN.Check-For-Updates" of file "plugins\SuperBans\config.yml"
# The file looks like this:
# https://proxy.spigotmc.org/afb4b8e87e99442322d76f6d7180a7bf42a9f62c?url=https://i.imgur.com/xPYjHPB.png

I need someone who can help me creating the same file with skript-yaml. (Checking if the value isn't set so it will be created in the file, setting a variable to it... The same as my code does, but using a different and better addon)
 
Last edited:
im not a translator but if you have any questions i can answer them ^.^
[doublepost=1522726396,1522714487][/doublepost]BAM drunk sashie is a bit nicer so here is a thing, you still have to play with it tho

code_language.skript:
on load:
   load yaml "plugins\SuperBans\config.yml" as "plugins\SuperBans\config.yml"
   skript-yaml "plugins\SuperBans\config.yml" is empty:
       set the header of "plugins\SuperBans\config.yml" to "  ___                    ___               " and " / __|_  _ _ __  ___ _ _| _ ) __ _ _ _  ___" and " \__ \ || | '_ \/ -_) '_| _ \/ _` | ' \(_-<" and " |___/\_,_| .__/\___|_| |___/\__,_|_||_/__/" and "          |_|                   by Sashie <3"
       set skript-yaml value "PUNISHMENTS.Notification-Type" from "plugins\SuperBans\config.yml" to "1"
       set skript-yaml value "PUNISHMENTS.Console-Notifications" from "plugins\SuperBans\config.yml" to "true"
       set skript-yaml value "PUNISHMENTS.Show-Leave-Message" from "plugins\SuperBans\config.yml" to "false"
       set skript-yaml value "PUNISHMENTS.Max-Warns" from "plugins\SuperBans\config.yml" to "4"

       set the comment of yaml node "PUNISHMENTS" from "plugins\SuperBans\config.yml" to "Notification-Type: This will be the type of notification sent on new punishments. Valid values are: '1' for messages, '2' for actionbars."

       set skript-yaml value "GUI.Unban-Messages" from "plugins\SuperBans\config.yml" to "true"
       set skript-yaml value "GUI.Keep-Open" from "plugins\SuperBans\config.yml" to "true"
       set skript-yaml value "GUI.Silent" from "plugins\SuperBans\config.yml" to "false"
       set skript-yaml value "SERVER.Name" from "plugins\SuperBans\config.yml" to "Server Name"
       set skript-yaml value "SERVER.Shop" from "plugins\SuperBans\config.yml" to "https://mc.yourserver.com/shop"
       set skript-yaml value "SERVER.Web" from "plugins\SuperBans\config.yml" to "https://mc.yourserver.com/formum"
       set skript-yaml value "DISALLOWED.COMMANDS.While-Frozen" from "plugins\SuperBans\config.yml" to ""
       add "spawn" to skript-yaml list "DISALLOWED.COMMANDS.While-Frozen" from "plugins\SuperBans\config.yml"
       add "warp" to skript-yaml list "DISALLOWED.COMMANDS.While-Frozen" from "plugins\SuperBans\config.yml"
       add "home" to skript-yaml list "DISALLOWED.COMMANDS.While-Frozen" from "plugins\SuperBans\config.yml"
       add "tpa" to skript-yaml list "DISALLOWED.COMMANDS.While-Frozen" from "plugins\SuperBans\config.yml"
       set skript-yaml value "DISALLOWED.COMMANDS.While-Muted" from "plugins\SuperBans\config.yml" to ""
       add "tell" to skript-yaml list "DISALLOWED.COMMANDS.While-Muted" from "plugins\SuperBans\config.yml"
       add "msg" to skript-yaml list "DISALLOWED.COMMANDS.While-Muted" from "plugins\SuperBans\config.yml"
       add "me" to skript-yaml list "DISALLOWED.COMMANDS.While-Muted" from "plugins\SuperBans\config.yml"
       set skript-yaml value "ANTISWEAR.Enabled" from "plugins\SuperBans\config.yml" to "true"
       set skript-yaml value "ANTISWEAR.Word-Replacer" from "plugins\SuperBans\config.yml" to "*"
       set skript-yaml value "ANTISWEAR.WORDS" from "plugins\SuperBans\config.yml" to ""
       add "fuck" to skript-yaml list "ANTISWEAR.WORDS" from "plugins\SuperBans\config.yml"
       add "dick" to skript-yaml list "ANTISWEAR.WORDS" from "plugins\SuperBans\config.yml"
       add "cunt" to skript-yaml list "ANTISWEAR.WORDS" from "plugins\SuperBans\config.yml"
       set skript-yaml value "MAIN.File-Name" from "plugins\SuperBans\config.yml" to "SuperBans"
       set skript-yaml value "MAIN.Check-For-Updates" from "plugins\SuperBans\config.yml" to "true"

       save yaml "plugins\SuperBans\config.yml"


#       write "## This will be the type of notification sent on new punishments. Valid values are: '1' for messages, '2' for actionbars." at line 2 to file "plugins\SuperBans\config.yml"
#       write "" at line 7 to file "plugins\SuperBans\config.yml"
#       write "" at line 12 to file "plugins\SuperBans\config.yml"
#       write "" at line 17 to file "plugins\SuperBans\config.yml"
#       write "" at line 29 to file "plugins\SuperBans\config.yml"
#       write "" at line 37 to file "plugins\SuperBans\config.yml"

   set {OPTIONS::PUNISHMENTS::Notification-Type} to skript-yaml value "PUNISHMENTS.Notification-Type" of "plugins\SuperBans\config.yml"
   set {OPTIONS::PUNISHMENTS::Console-Notifications} to skript-yaml value "PUNISHMENTS.Console-Notifications" of "plugins\SuperBans\config.yml"
   set {OPTIONS::PUNISHMENTS::Show-Leave-Message} to skript-yaml value "PUNISHMENTS.Show-Leave-Message" of "plugins\SuperBans\config.yml"
   set {OPTIONS::PUNISHMENTS::Max-Warns} to skript-yaml value "PUNISHMENTS.Max-Warns" of "plugins\SuperBans\config.yml"
   set {OPTIONS::GUI::Unban-Messages} to skript-yaml value "GUI.Unban-Messages" of "plugins\SuperBans\config.yml"
   set {OPTIONS::GUI::Keep-Open} to skript-yaml value "GUI.Keep-Open" of "plugins\SuperBans\config.yml"
   set {OPTIONS::GUI::Silent} to skript-yaml value "GUI.Silent" of "plugins\SuperBans\config.yml"
   set {OPTIONS::SERVER::Name} to skript-yaml value "SERVER.Name" of "plugins\SuperBans\config.yml"
   set {OPTIONS::SERVER::Shop} to skript-yaml value "SERVER.Shop" of "plugins\SuperBans\config.yml"
   set {OPTIONS::SERVER::Web} to skript-yaml value "SERVER.Web" of "plugins\SuperBans\config.yml"
   set {OPTIONS::DISALLOWED::COMMANDS::While-Frozen::*} to skript-yaml list "DISALLOWED.COMMANDS.While-Frozen" of "plugins\SuperBans\config.yml"
   set {OPTIONS::DISALLOWED::COMMANDS::While-Muted::*} to skript-yaml list "DISALLOWED.COMMANDS.While-Muted" of "plugins\SuperBans\config.yml"
   set {OPTIONS::ANTISWEAR::Enabled} to skript-yaml value "ANTISWEAR.Enabled" of "plugins\SuperBans\config.yml"
   set {OPTIONS::ANTISWEAR::Word-Replacer} to skript-yaml value "ANTISWEAR.Word-Replacer" of "plugins\SuperBans\config.yml"
   set {OPTIONS::ANTISWEAR::WORDS::*} to skript-yaml list "ANTISWEAR.WORDS" of "plugins\SuperBans\config.yml"
   set {OPTIONS::MAIN::File-Name} to skript-yaml value "MAIN.File-Name" of "plugins\SuperBans\config.yml"
   set {OPTIONS::MAIN::Check-For-Updates} to skript-yaml value "MAIN.Check-For-Updates" of "plugins\SuperBans\config.yml"
 
  • Like
Reactions: KroterPvP