Hey there, I have a very complex question. I want to know how to copy files from an intern folder in the jar file (For example from from /com/Scrapnix/name/afunnyfolder/file.schematic) to a extern plugin folder (I want to copy a schematic into the /plugins/PLUGINNAME/schematics/file.schematic) Does someone know how to copy the file? I hope someone can help me
Do you mean Copy a File from 1 Plugin Source Code into another Plugin Source Code? Or you asking for just copying a file into another dataFolder of another Plugin
There's a JavaPlugin#getResource() method that returns an InputStream. Convert that into a file and save it somewhere.
@KingDragonRider @Phloxz No, I want to copy a file from the jar into the plugin-folder, the /plugins/PLUGINNAME/ folder.
So you mean something like this right? Code (Text): try { InputStream stream = mainClass.getResource("FILENAME"); FileUtils.copyInputStreamToFile(stream, new File(mainClass.getDataFolder(),"PLUGINFILENAME")); } catch (IOException e) { e.printStackTrace(); }
Check out this post: http://stackoverflow.com/questions/...e-from-the-currently-running-jar-through-code