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.

How to create a yaml file like mine with skript-yaml

Discussion in 'Requests' started by KroterPvP, Apr 1, 2018.

  1. KroterPvP

    KroterPvP Active Member

    Joined:
    Apr 10, 2017
    Messages:
    178
    Likes Received:
    7
    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 (Skript):
    1. on load:
    2.     file "plugins\SuperBans\config.yml" doesn't exist:
    3.         create file "plugins\SuperBans\config.yml"
    4.         set skutil yaml value "PUNISHMENTS.Notification-Type" from file "plugins\SuperBans\config.yml" to "1"
    5.         set skutil yaml value "PUNISHMENTS.Console-Notifications" from file "plugins\SuperBans\config.yml" to "true"
    6.         set skutil yaml value "PUNISHMENTS.Show-Leave-Message" from file "plugins\SuperBans\config.yml" to "false"
    7.         set skutil yaml value "PUNISHMENTS.Max-Warns" from file "plugins\SuperBans\config.yml" to "4"
    8.         set skutil yaml value "GUI.Unban-Messages" from file "plugins\SuperBans\config.yml" to "true"
    9.         set skutil yaml value "GUI.Keep-Open" from file "plugins\SuperBans\config.yml" to "true"
    10.         set skutil yaml value "GUI.Silent" from file "plugins\SuperBans\config.yml" to "false"
    11.         set skutil yaml value "SERVER.Name" from file "plugins\SuperBans\config.yml" to "Server Name"
    12.         set skutil yaml value "SERVER.Shop" from file "plugins\SuperBans\config.yml" to "https://mc.yourserver.com/shop"
    13.         set skutil yaml value "SERVER.Web" from file "plugins\SuperBans\config.yml" to "https://mc.yourserver.com/formum"
    14.         set skutil yaml value "DISALLOWED.COMMANDS.While-Frozen" from file "plugins\SuperBans\config.yml" to ""
    15.         add "spawn" to skutil yaml list "DISALLOWED.COMMANDS.While-Frozen" from file "plugins\SuperBans\config.yml"
    16.         add "warp" to skutil yaml list "DISALLOWED.COMMANDS.While-Frozen" from file "plugins\SuperBans\config.yml"
    17.         add "home" to skutil yaml list "DISALLOWED.COMMANDS.While-Frozen" from file "plugins\SuperBans\config.yml"
    18.         add "tpa" to skutil yaml list "DISALLOWED.COMMANDS.While-Frozen" from file "plugins\SuperBans\config.yml"
    19.         set skutil yaml value "DISALLOWED.COMMANDS.While-Muted" from file "plugins\SuperBans\config.yml" to ""
    20.         add "tell" to skutil yaml list "DISALLOWED.COMMANDS.While-Muted" from file "plugins\SuperBans\config.yml"
    21.         add "msg" to skutil yaml list "DISALLOWED.COMMANDS.While-Muted" from file "plugins\SuperBans\config.yml"
    22.         add "me" to skutil yaml list "DISALLOWED.COMMANDS.While-Muted" from file "plugins\SuperBans\config.yml"
    23.         set skutil yaml value "ANTISWEAR.Enabled" from file "plugins\SuperBans\config.yml" to "true"
    24.         set skutil yaml value "ANTISWEAR.Word-Replacer" from file "plugins\SuperBans\config.yml" to "*"
    25.         set skutil yaml value "ANTISWEAR.WORDS" from file "plugins\SuperBans\config.yml" to ""
    26.         add "fuck" to skutil yaml list "ANTISWEAR.WORDS" from file "plugins\SuperBans\config.yml"
    27.         add "dick" to skutil yaml list "ANTISWEAR.WORDS" from file "plugins\SuperBans\config.yml"
    28.         add "cunt" to skutil yaml list "ANTISWEAR.WORDS" from file "plugins\SuperBans\config.yml"
    29.         set skutil yaml value "MAIN.File-Name" from file "plugins\SuperBans\config.yml" to "SuperBans"
    30.         set skutil yaml value "MAIN.Check-For-Updates" from file "plugins\SuperBans\config.yml" to "true"
    31.  
    32.         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"
    33.         write "" at line 7 to file "plugins\SuperBans\config.yml"
    34.         write "" at line 12 to file "plugins\SuperBans\config.yml"
    35.         write "" at line 17 to file "plugins\SuperBans\config.yml"
    36.         write "" at line 29 to file "plugins\SuperBans\config.yml"
    37.         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"
    38.     set {OPTIONS::PUNISHMENTS::Console-Notifications} to yml value "PUNISHMENTS.Console-Notifications" of file "plugins\SuperBans\config.yml"
    39.     set {OPTIONS::PUNISHMENTS::Show-Leave-Message} to yml value "PUNISHMENTS.Show-Leave-Message" of file "plugins\SuperBans\config.yml"
    40.     set {OPTIONS::PUNISHMENTS::Max-Warns} to yml value "PUNISHMENTS.Max-Warns" of file "plugins\SuperBans\config.yml"
    41.     set {OPTIONS::GUI::Unban-Messages} to yml value "GUI.Unban-Messages" of file "plugins\SuperBans\config.yml"
    42.     set {OPTIONS::GUI::Keep-Open} to yml value "GUI.Keep-Open" of file "plugins\SuperBans\config.yml"
    43.     set {OPTIONS::GUI::Silent} to yml value "GUI.Silent" of file "plugins\SuperBans\config.yml"
    44.     set {OPTIONS::SERVER::Name} to yml value "SERVER.Name" of file "plugins\SuperBans\config.yml"
    45.     set {OPTIONS::SERVER::Shop} to yml value "SERVER.Shop" of file "plugins\SuperBans\config.yml"
    46.     set {OPTIONS::SERVER::Web} to yml value "SERVER.Web" of file "plugins\SuperBans\config.yml"
    47.     set {OPTIONS::DISALLOWED::COMMANDS::While-Frozen::*} to yml list "DISALLOWED.COMMANDS.While-Frozen" of file "plugins\SuperBans\config.yml"
    48.     set {OPTIONS::DISALLOWED::COMMANDS::While-Muted::*} to yml list "DISALLOWED.COMMANDS.While-Muted" of file "plugins\SuperBans\config.yml"
    49.     set {OPTIONS::ANTISWEAR::Enabled} to yml value "ANTISWEAR.Enabled" of file "plugins\SuperBans\config.yml"
    50.     set {OPTIONS::ANTISWEAR::Word-Replacer} to yml value "ANTISWEAR.Word-Replacer" of file "plugins\SuperBans\config.yml"
    51.     set {OPTIONS::ANTISWEAR::WORDS::*} to yml list "ANTISWEAR.WORDS" of file "plugins\SuperBans\config.yml"
    52.     set {OPTIONS::MAIN::File-Name} to yml value "MAIN.File-Name" of file "plugins\SuperBans\config.yml"
    53.     set {OPTIONS::MAIN::Check-For-Updates} to yml value "MAIN.Check-For-Updates" of file "plugins\SuperBans\config.yml"
    54. # The file looks like this:
    55. # 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)
     
    #1 KroterPvP, Apr 1, 2018
    Last edited: Apr 1, 2018
  2. LimeGlass

    VIP Supporter Addon Developer

    Joined:
    Jan 24, 2017
    Messages:
    621
    Likes Received:
    436
    Medals:
  3. Sashie

    Moderator Addon Developer

    Joined:
    Jan 22, 2017
    Messages:
    52
    Likes Received:
    49
    im not a translator but if you have any questions i can answer them ^.^
    --- Double Post Merged, Apr 3, 2018, Original Post Date: Apr 3, 2018 ---
    BAM drunk sashie is a bit nicer so here is a thing, you still have to play with it tho

    Code (Skript):
    1.  
    2. on load:
    3.    load yaml "plugins\SuperBans\config.yml" as "plugins\SuperBans\config.yml"
    4.    skript-yaml "plugins\SuperBans\config.yml" is empty:
    5.        set the header of "plugins\SuperBans\config.yml" to "  ___                    ___               " and " / __|_  _ _ __  ___ _ _| _ ) __ _ _ _  ___" and " \__ \ || | '_ \/ -_) '_| _ \/ _` | ' \(_-<" and " |___/\_,_| .__/\___|_| |___/\__,_|_||_/__/" and "          |_|                   by Sashie <3"
    6.        set skript-yaml value "PUNISHMENTS.Notification-Type" from "plugins\SuperBans\config.yml" to "1"
    7.        set skript-yaml value "PUNISHMENTS.Console-Notifications" from "plugins\SuperBans\config.yml" to "true"
    8.        set skript-yaml value "PUNISHMENTS.Show-Leave-Message" from "plugins\SuperBans\config.yml" to "false"
    9.        set skript-yaml value "PUNISHMENTS.Max-Warns" from "plugins\SuperBans\config.yml" to "4"
    10.  
    11.        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."
    12.  
    13.        set skript-yaml value "GUI.Unban-Messages" from "plugins\SuperBans\config.yml" to "true"
    14.        set skript-yaml value "GUI.Keep-Open" from "plugins\SuperBans\config.yml" to "true"
    15.        set skript-yaml value "GUI.Silent" from "plugins\SuperBans\config.yml" to "false"
    16.        set skript-yaml value "SERVER.Name" from "plugins\SuperBans\config.yml" to "Server Name"
    17.        set skript-yaml value "SERVER.Shop" from "plugins\SuperBans\config.yml" to "https://mc.yourserver.com/shop"
    18.        set skript-yaml value "SERVER.Web" from "plugins\SuperBans\config.yml" to "https://mc.yourserver.com/formum"
    19.        set skript-yaml value "DISALLOWED.COMMANDS.While-Frozen" from "plugins\SuperBans\config.yml" to ""
    20.        add "spawn" to skript-yaml list "DISALLOWED.COMMANDS.While-Frozen" from "plugins\SuperBans\config.yml"
    21.        add "warp" to skript-yaml list "DISALLOWED.COMMANDS.While-Frozen" from "plugins\SuperBans\config.yml"
    22.        add "home" to skript-yaml list "DISALLOWED.COMMANDS.While-Frozen" from "plugins\SuperBans\config.yml"
    23.        add "tpa" to skript-yaml list "DISALLOWED.COMMANDS.While-Frozen" from "plugins\SuperBans\config.yml"
    24.        set skript-yaml value "DISALLOWED.COMMANDS.While-Muted" from "plugins\SuperBans\config.yml" to ""
    25.        add "tell" to skript-yaml list "DISALLOWED.COMMANDS.While-Muted" from "plugins\SuperBans\config.yml"
    26.        add "msg" to skript-yaml list "DISALLOWED.COMMANDS.While-Muted" from "plugins\SuperBans\config.yml"
    27.        add "me" to skript-yaml list "DISALLOWED.COMMANDS.While-Muted" from "plugins\SuperBans\config.yml"
    28.        set skript-yaml value "ANTISWEAR.Enabled" from "plugins\SuperBans\config.yml" to "true"
    29.        set skript-yaml value "ANTISWEAR.Word-Replacer" from "plugins\SuperBans\config.yml" to "*"
    30.        set skript-yaml value "ANTISWEAR.WORDS" from "plugins\SuperBans\config.yml" to ""
    31.        add "fuck" to skript-yaml list "ANTISWEAR.WORDS" from "plugins\SuperBans\config.yml"
    32.        add "dick" to skript-yaml list "ANTISWEAR.WORDS" from "plugins\SuperBans\config.yml"
    33.        add "cunt" to skript-yaml list "ANTISWEAR.WORDS" from "plugins\SuperBans\config.yml"
    34.        set skript-yaml value "MAIN.File-Name" from "plugins\SuperBans\config.yml" to "SuperBans"
    35.        set skript-yaml value "MAIN.Check-For-Updates" from "plugins\SuperBans\config.yml" to "true"
    36.  
    37.        save yaml "plugins\SuperBans\config.yml"
    38.  
    39.  
    40. #       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"
    41. #       write "" at line 7 to file "plugins\SuperBans\config.yml"
    42. #       write "" at line 12 to file "plugins\SuperBans\config.yml"
    43. #       write "" at line 17 to file "plugins\SuperBans\config.yml"
    44. #       write "" at line 29 to file "plugins\SuperBans\config.yml"
    45. #       write "" at line 37 to file "plugins\SuperBans\config.yml"
    46.  
    47.    set {OPTIONS::PUNISHMENTS::Notification-Type} to skript-yaml value "PUNISHMENTS.Notification-Type" of "plugins\SuperBans\config.yml"
    48.    set {OPTIONS::PUNISHMENTS::Console-Notifications} to skript-yaml value "PUNISHMENTS.Console-Notifications" of "plugins\SuperBans\config.yml"
    49.    set {OPTIONS::PUNISHMENTS::Show-Leave-Message} to skript-yaml value "PUNISHMENTS.Show-Leave-Message" of "plugins\SuperBans\config.yml"
    50.    set {OPTIONS::PUNISHMENTS::Max-Warns} to skript-yaml value "PUNISHMENTS.Max-Warns" of "plugins\SuperBans\config.yml"
    51.    set {OPTIONS::GUI::Unban-Messages} to skript-yaml value "GUI.Unban-Messages" of "plugins\SuperBans\config.yml"
    52.    set {OPTIONS::GUI::Keep-Open} to skript-yaml value "GUI.Keep-Open" of "plugins\SuperBans\config.yml"
    53.    set {OPTIONS::GUI::Silent} to skript-yaml value "GUI.Silent" of "plugins\SuperBans\config.yml"
    54.    set {OPTIONS::SERVER::Name} to skript-yaml value "SERVER.Name" of "plugins\SuperBans\config.yml"
    55.    set {OPTIONS::SERVER::Shop} to skript-yaml value "SERVER.Shop" of "plugins\SuperBans\config.yml"
    56.    set {OPTIONS::SERVER::Web} to skript-yaml value "SERVER.Web" of "plugins\SuperBans\config.yml"
    57.    set {OPTIONS::DISALLOWED::COMMANDS::While-Frozen::*} to skript-yaml list "DISALLOWED.COMMANDS.While-Frozen" of "plugins\SuperBans\config.yml"
    58.    set {OPTIONS::DISALLOWED::COMMANDS::While-Muted::*} to skript-yaml list "DISALLOWED.COMMANDS.While-Muted" of "plugins\SuperBans\config.yml"
    59.    set {OPTIONS::ANTISWEAR::Enabled} to skript-yaml value "ANTISWEAR.Enabled" of "plugins\SuperBans\config.yml"
    60.    set {OPTIONS::ANTISWEAR::Word-Replacer} to skript-yaml value "ANTISWEAR.Word-Replacer" of "plugins\SuperBans\config.yml"
    61.    set {OPTIONS::ANTISWEAR::WORDS::*} to skript-yaml list "ANTISWEAR.WORDS" of "plugins\SuperBans\config.yml"
    62.    set {OPTIONS::MAIN::File-Name} to skript-yaml value "MAIN.File-Name" of "plugins\SuperBans\config.yml"
    63.    set {OPTIONS::MAIN::Check-For-Updates} to skript-yaml value "MAIN.Check-For-Updates" of "plugins\SuperBans\config.yml"
    64.  
     
    • Like Like x 1

Share This Page

Loading...