Solved Copying a resource file from the JavaProject

Discussion in 'Plugin Development' started by Kassestral, Jun 11, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    Kassestral

    Code:
        @EventHandler
        public void onPlayerJoin(PlayerJoinEvent event) throws IOException {
            File playerfile = new File(plugin.getDataFolder() + File.separator + "players" + File.separator + event.getPlayer().getUniqueId() + ".yml");
            String template = plugin.getClass().getResource("/playerfile.yml").getFile();
            File file = new File(template);
            YamlConfiguration default_file = YamlConfiguration.loadConfiguration(file);
            default_file.save(playerfile);
        }
    I have never tried to get a resource before, but I would of thought this would have worked, unfortunately not, does anyone know how I would get playerfile.yml from the Java Project and copy it to a new path?
     
  2. Offline

    567legodude

  3. Offline

    Kassestral

Thread Status:
Not open for further replies.

Share This Page