Fixed default skill configs not loading

This commit is contained in:
Jules 2024-07-26 16:05:31 -07:00
parent 25ca6e32a4
commit fa40f3707d
94 changed files with 9 additions and 11 deletions

View File

@ -57,19 +57,17 @@ public class SkillManager implements MMOCoreManager {
// Save default files if necessary // Save default files if necessary
final File skillFolder = FileUtils.getFile(MMOCore.plugin, "skills"); final File skillFolder = FileUtils.getFile(MMOCore.plugin, "skills");
if (!skillFolder.exists()) if (!skillFolder.exists()) try {
try { skillFolder.mkdir();
skillFolder.mkdir();
for (SkillHandler handler : MythicLib.plugin.getSkills().getHandlers()) { for (SkillHandler<?> handler : MythicLib.plugin.getSkills().getHandlers()) {
final InputStream res = MMOCore.plugin.getResource("default/skills/default_mmo_skills/" + handler.getLowerCaseId() + ".yml"); final InputStream res = MMOCore.plugin.getResource("default/skills/" + handler.getLowerCaseId() + ".yml");
MMOCore.plugin.getLogger().log(Level.INFO, ("default/skills/default_mmo_skills/" + handler.getLowerCaseId() + ".yml") + " => " + (res != null)); if (res != null)
if (res != null) Files.copy(res, new File(MMOCore.plugin.getDataFolder() + "/skills/" + handler.getLowerCaseId() + ".yml").getAbsoluteFile().toPath());
Files.copy(res, new File(MMOCore.plugin.getDataFolder() + "/skills/default_mmo_skills/" + handler.getLowerCaseId() + ".yml").getAbsoluteFile().toPath());
}
} catch (IOException exception) {
MMOCore.plugin.getLogger().log(Level.WARNING, "Could not save default skill configs: " + exception.getMessage());
} }
} catch (IOException exception) {
MMOCore.plugin.getLogger().log(Level.WARNING, "Could not save default skill configs: " + exception.getMessage());
}
// Load skills // Load skills
FileUtils.loadObjectsFromFolder(MMOCore.plugin, "skills", true, (name, config) -> { FileUtils.loadObjectsFromFolder(MMOCore.plugin, "skills", true, (name, config) -> {