mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-23 00:05:52 +01:00
exp-sources.yml to have predownloaded exp sources you can refer to anywhere (like experience tables)
This commit is contained in:
parent
6af4c2ee46
commit
eac9cfa74e
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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"));
|
||||
|
0
src/main/resources/default/exp-sources.yml
Normal file
0
src/main/resources/default/exp-sources.yml
Normal file
Loading…
Reference in New Issue
Block a user