Retrieving data from a file

Discussion in 'Spigot Plugin Development' started by DecisionsYT, May 17, 2016.

  1. Hey! (I know this is a dumb question xD)

    I've created "blocked.yml"

    How do I get a string from it?? And how do I get a stringList from it??


    CREATED BY:
    Code (Text):
    File pluginfile = new File("plugins/ChatX/blocked.yml");
                    if (!pluginfile.exists()){
                        try {
                            pluginfile.createNewFile();
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    }
     
  2. https://hub.spigotmc.org/javadocs/spigot/org/bukkit/configuration/file/YamlConfiguration.html
    https://hub.spigotmc.org/javadocs/s...emorySection.html#getString(java.lang.String)
    https://hub.spigotmc.org/javadocs/s...ySection.html#getStringList(java.lang.String)
     
  3. FileConfiguration conf = YamlConfiguration.loadConfiguration(File file);
    conf.method() is the same as plugin.getConfig().method() it just pulls from a different file rather than config.yml
     
  4. Thx


    Sent from my iPod touch using Tapatalk