Alright, I know I typically help around here, I need help. This was working earlier and it's completely drawn a blank and I don't want to spend hours combing through this countless times to figure out that stupid mistake I've made... Oh btw, sorry for the poorly formatted code, it does that for some reason. I've marked out all the errors in the code with LINE (LINE NUMBER) Alright, So I can't figure out why my code gives me this error Code (Text): [18:18:49 WARN]: java.lang.IllegalArgumentException: The embedded resource 'plugins/CustomCrates/Crates/BasicCrate.crate' cannot be found in plugins/CustomCrates.jar [18:18:49 WARN]: at org.bukkit.plugin.java.JavaPlugin.saveResource(JavaPlugin.java:252) [18:18:49 WARN]: at me.ztowne13.customcrates.utils.FileUtil.saveDefaults(FileUtil.java:116) [18:18:49 WARN]: at me.ztowne13.customcrates.CustomCrates.firstLoadFiles(CustomCrates.java:68) [18:18:49 WARN]: at me.ztowne13.customcrates.utils.FileUtil.reload(FileUtil.java:55) [18:18:49 WARN]: at me.ztowne13.customcrates.utils.FileUtil.saveDefaults(FileUtil.java:111) [18:18:49 WARN]: at me.ztowne13.customcrates.CustomCrates.loadFiles(CustomCrates.java:57) [18:18:49 WARN]: at me.ztowne13.customcrates.CustomCrates.onEnable(CustomCrates.java:25) [18:18:49 WARN]: at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) [18:18:49 WARN]: at a lot of useless stuff... [18:18:49 ERROR]: Error occurred while enabling CustomCrates v1.0 (Is it up to date?) java.lang.IllegalArgumentException: The embedded resource 'plugins/CustomCrates/Messages.yml' cannot be found in plugins/CustomCrates.jar at org.bukkit.plugin.java.JavaPlugin.saveResource(JavaPlugin.java:252) ~[spigot.jar:git-Spigot-2f787bd-1a1bc08] at me.ztowne13.customcrates.utils.FileUtil.saveDefaults(FileUtil.java:116) ~[?:?] at me.ztowne13.customcrates.CustomCrates.loadFiles(CustomCrates.java:57) ~[?:?] at me.ztowne13.customcrates.CustomCrates.onEnable(CustomCrates.java:25) ~[?:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[spigot.jar:git-Spigot-2f787bd-1a1bc08] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:335) [spigot.jar:git-Spigot-2f787bd-1a1bc08] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot.jar:git-Spigot-2f787bd-1a1bc08] at a lot of useless more stuff :) My FileUtil class (Yes It's a mess, I copied it off the internet like a year ago.) Code (Text): static HashMap<String,FileUtil> map = new HashMap<String,FileUtil>(); String name; String directory = ""; CustomCrates cc; public FileUtil(CustomCrates cc, String name, String directory) { this.name = name; this.cc = cc; this.directory = directory; map.put(name, this); } public FileUtil(CustomCrates cc, String name) { this.name = name; this.cc = cc; map.put(name, this); } FileConfiguration Data = null; File DataFile = null; public void reload() { if (DataFile == null) { DataFile = new File(new File(cc.getDataFolder() + directory), name); if(name.equalsIgnoreCase("Messages.yml")) { if(!hasFolder("Crates")) { new File(cc.getDataFolder() + directory).mkdir(); } try { LINE 55 cc.firstLoadFiles(); } catch(Exception exc) { exc.printStackTrace(); } } } Data = YamlConfiguration.loadConfiguration(DataFile); InputStream defConfigStream = cc.getResource(name); if (defConfigStream != null) { YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream); Data.setDefaults(defConfig); } } public boolean hasFolder(String path) { for(File file: cc.getDataFolder().listFiles()) { return file.isDirectory() && file.getName().equalsIgnoreCase(path.replace("/", "")); } returnfalse; } publicvoid save() { if (Data == null || DataFile == null) { return; } try { get().save(DataFile); } catch (IOException ex) { cc.getLogger().log(Level.SEVERE, "Could not save config to " + DataFile, ex); } } public FileConfiguration get() { if (Data == null) { reload(); } return Data; } public void saveDefaults() { if(DataFile == null) { LINE 111 reload(); } if(!DataFile.exists()) { LINE 116 cc.saveResource(cc.getDataFolder() + directory + "/" + name, false); } } My onEnable() Code (Text): public void onEnable() { LINE 25 loadFiles(); registerAll(); this.du = new DebugUtils(); this.settings = new Settings(this); settings.load(); run(); } My firstLoadFiles method Code (Text): public void firstLoadFiles() { String[] firstFiles = new String[]{"BasicCrate", "BeginnerCrate", "MiddleCrate", "MasterCrate"}; for(String newFile: firstFiles) { LINE 68 new FileUtil(this, newFile + ".crate", "/Crates").saveDefaults(); } } Line 57 of Custom Crates Code (Text): LINE 57 message.saveDefaults(); Thanks for any help
@ztowne13 I am pretty sure that the path 'plugins/CustomCrates/Messages.yml' does not exist in your jar (so in your jar, you have a folder plugins, which contains a folder CustomCrates, which contains a file called Messages.yml). If you do, then I am amazed by your jar structure.
@DarkSeraphim Ahh, I think I know what you mean and I think i may no the issue... Let me try a thing here real quick
java.lang.IllegalArgumentException: The embedded resource 'plugins/CustomCrates/Crates/BasicCrate.crate' cannot be found in plugins/CustomCrates.jar why do you want the .crate extension type?