The code only config.yml works

Discussion in 'Spigot Plugin Development' started by Frealy1995, Jun 15, 2016.

  1. Hello, the code a only config.yml working.

    I create a arena.yml and I using getConfig(); only get data from config.yml

    Code (Text):
    String prefix = plugin.getConfig().getString("prefix");
    Code (Text):

        public void Config(){
            File file = new File(getDataFolder(), "config.yml");
  2. 1. You don't need to do the if (!file.exists()). saveDefaultConfig() checks that for you.
    2. That method copies "config.yml" from your jar to your plugins folder. If it's called arenas.yml it will not work.
  3. Okey, I remove if(!file.exists()) and how to using other configration files?
  4. If you DO want to use "arenas.yml", you can do
    Code (Text):
    saveResource("arenas.yml", false);
    you don't need to check if the file exists with that either.
  5. Yes, I understand and how to get string arenas.yml ?
    Code (Text):
    String prefix = plugin.getConfig().getString("prefix");
    the code only config.yml data transfer
  6. Ah okay.

    You need to make a new FileConfiguration object like this:
    Code (Text):
    FileConfiguration arenas = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "arenas.yml"));
    • Like Like x 1
  7. Thanks :)
  8. Help me

    FileConfiguration arenas = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "arenas.yml"));

    arenas.getString() not there is? How to using the code? getString() and getInt() etz?
  9. Should be arenas.getConfig().getString()
  10. [​IMG]
  11. Okey now working arenas.getString() or arenas.getInt() and other java class not works?

    Code (Text):
    public static FileConfiguration arenas = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "arenas.yml"));
  12. I'll simply tell you about this one thing you'll need to develop Spigot/Bukkit plugins.
    It's very secret, okay? Top secret!
    Not many do this nowadays..

    Learn Java!
    *play spooky music*
  13. Yes i was mistaken... I use a yml maker where i first have to get the FileConfiguration.... you should just do arena.getString()/getInt() and so on