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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

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 'Skript' started by KroterPvP, Apr 1, 2018.

Thread Status:
Not open for further replies.
  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)
     
Thread Status:
Not open for further replies.

Share This Page

Loading...