YAML Files

Discussion in 'Spigot Plugin Help' started by HatredPvP, May 4, 2017.

  1. Hi, I have been experimenting with config,data,language files. I was wondering how would I go about having them each in their own files, and getting/setting them in classes (I looked at the docs, still dont understand it)
  2. WAS


    Code (Java):
    YamlConfiguration yml = new YamlConfiguration();
    // Load a YAML file...
    // Get a "String"
    yml.getString("local.some-string", "Default Lang String");
    // Set a value
    yml.set("local.some-string", "Some new string");
    // Save yaml file
    Maybe something like that?

    Woops, you'll need to supply a File

    Code (Java):
    File langConfig = new File(plugin.getDataFolder().getPath()+"myLangFile.yml");
    #2 WAS, May 4, 2017
    Last edited: May 4, 2017