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