diff --git a/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java b/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java index 03054204..8c01f63b 100644 --- a/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java +++ b/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java @@ -1,5 +1,7 @@ package net.Indyuce.mmocore.api.load; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.ConfigFile; import net.Indyuce.mmocore.api.block.BlockType; import net.Indyuce.mmocore.api.block.SkullBlockType; import net.Indyuce.mmocore.api.block.VanillaBlockType; @@ -30,6 +32,9 @@ import net.Indyuce.mmocore.api.quest.trigger.StaminaTrigger; import net.Indyuce.mmocore.api.quest.trigger.StelliumTrigger; import net.Indyuce.mmocore.api.quest.trigger.Trigger; import io.lumine.mythic.lib.api.MMOLineConfig; +import org.checkerframework.checker.units.qual.C; + +import java.util.logging.Level; public class DefaultMMOLoader extends MMOLoader { @@ -118,6 +123,19 @@ public class DefaultMMOLoader extends MMOLoader { @Override public ExperienceSource loadExperienceSource(MMOLineConfig config, ExperienceDispenser dispenser) { + if(config.getKey().equals("from")) { + String source=config.getString("source"); + ConfigFile configFile= new ConfigFile("exp-sources"); + if(!configFile.getConfig().contains(source)) { + MMOCore.plugin.getLogger().log(Level.WARNING,"Couldn't find "+source+" in experience-sources.yml"); + return null; + } + for(String expSource: configFile.getConfig().getStringList(source)) { + loadExperienceSource(new MMOLineConfig(expSource),dispenser); + } + } + + if (config.getKey().equals("resource")) return new ResourceExperienceSource(dispenser, config); diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java index 7ced6650..00a4cf6e 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java @@ -156,8 +156,8 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { "Could not load option '" + key + "' from class '" + key + "': " + exception.getMessage()); } - if (config.contains("main-exp-sources")) { - for (String key : config.getStringList("main-exp-sources")) + if (config.contains("main-exp-sources.yml")) { + for (String key : config.getStringList("main-exp-sources.yml")) try { ExperienceSource source = MMOCore.plugin.loadManager.loadExperienceSource(new MMOLineConfig(key), this); MMOCore.plugin.experience.registerSource(source); diff --git a/src/main/java/net/Indyuce/mmocore/experience/Profession.java b/src/main/java/net/Indyuce/mmocore/experience/Profession.java index ac71dc28..9041ea12 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/Profession.java +++ b/src/main/java/net/Indyuce/mmocore/experience/Profession.java @@ -64,8 +64,8 @@ public class Profession extends PostLoadObject implements ExperienceObject { maxLevel = config.getInt("max-level"); - if (config.contains("exp-sources")) - for (String key : config.getStringList("exp-sources")) + if (config.contains("exp-sources.yml")) + for (String key : config.getStringList("exp-sources.yml")) try { MMOCore.plugin.experience.registerSource(MMOCore.plugin.loadManager.loadExperienceSource(new MMOLineConfig(key), this)); } catch (IllegalArgumentException exception) { diff --git a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java index fb990c21..2234376a 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java @@ -87,6 +87,7 @@ public class ConfigManager { loadDefaultFile("loot-chests.yml"); loadDefaultFile("commands.yml"); loadDefaultFile("exp-tables.yml"); + loadDefaultFile("exp-sources.yml"); loadDefaultFile("guilds.yml"); commandVerbose.reload(MMOCore.plugin.getConfig().getConfigurationSection("command-verbose")); diff --git a/src/main/resources/default/exp-sources.yml b/src/main/resources/default/exp-sources.yml new file mode 100644 index 00000000..e69de29b