Yamls Help

Discussion in 'Spigot Plugin Development' started by Dantesudante, Jun 6, 2017.

  1. How I can make a Method that create a Yaml (with Player who Join) in a new Folder?

    Code (Text):
    public class YamlInventory {
       
       
        public void yamlCreate(Player player) throws IOException {
           
            File playerFile = new File ("plugins/ChestPet/PlayersInventory/", player.getUniqueId().toString()+".yml/"); //"plugins/ChestPet/PlayersInventory/"
            FileConfiguration playerData = YamlConfiguration.loadConfiguration(playerFile);
           
            if (!(playerFile.exists())) {
                playerFile.createNewFile();
            }
            else {
                player.sendMessage("vuoto");
            }
           
        }
       
    }
    Code (Text):
        @EventHandler
        public void OnPlayerJoin(PlayerJoinEvent e) throws IOException {

            YamlInventory yaml = new YamlInventory() ;
            yaml.yamlCreate(e.getPlayer());
        }
     
  2. Why do you need the YamlConfiguration? Do you have the folders in which it is in it?
     
  3. Maybe the directory is wrong, the files should be salved inside my .jar plugin under