build commit
This commit is contained in:
parent
07b5010f74
commit
f3fa8563e6
|
|
@ -53,31 +53,46 @@ public class MobTypes extends AbstractConfig {
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private static void load() {
|
private static void load() {
|
||||||
MOB_TYPES.clear();
|
MOB_TYPES.clear();
|
||||||
|
log.info("Loading mob types");
|
||||||
ConfigurationSection configurationSection = config.getConfigurationSection(prefix.substring(0, prefix.length() - 1));
|
ConfigurationSection configurationSection = config.getConfigurationSection(prefix.substring(0, prefix.length() - 1));
|
||||||
if (configurationSection == null) {
|
if (configurationSection == null) {
|
||||||
log.warn("No config section found for {}", prefix.substring(0, prefix.length() - 1));
|
log.warn("No config section found for {}", prefix.substring(0, prefix.length() - 1));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
log.info("1");
|
||||||
Set<String> keys = configurationSection.getKeys(false);
|
Set<String> keys = configurationSection.getKeys(false);
|
||||||
|
log.info("2");
|
||||||
keys.forEach(key -> {
|
keys.forEach(key -> {
|
||||||
List<Ability> abilities = config.getStringList(prefix + key, ".abilities", List.of()).stream()
|
List<Ability> abilities = config.getStringList(prefix + key, ".abilities", List.of()).stream()
|
||||||
.map(MobTypes.MOB_TYPES::getAbility)
|
.map(MobTypes.MOB_TYPES::getAbility)
|
||||||
.filter(Optional::isPresent)
|
.filter(Optional::isPresent)
|
||||||
.map(Optional::get)
|
.map(Optional::get)
|
||||||
.toList();
|
.toList();
|
||||||
|
log.info("3");
|
||||||
List<EntityModifier> entityModifiers = new ArrayList<>();
|
List<EntityModifier> entityModifiers = new ArrayList<>();
|
||||||
|
log.info("4");
|
||||||
config.getConfigurationSection(prefix + key + ".modifiers").getKeys(false).forEach(modifier -> {
|
config.getConfigurationSection(prefix + key + ".modifiers").getKeys(false).forEach(modifier -> {
|
||||||
|
log.info("5");
|
||||||
String attribute = config.getString(prefix + key + ".modifiers." + modifier, "attribute", null);
|
String attribute = config.getString(prefix + key + ".modifiers." + modifier, "attribute", null);
|
||||||
|
log.info("6");
|
||||||
if (attribute == null) {
|
if (attribute == null) {
|
||||||
|
log.info("RETURN (7)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
log.info("8");
|
||||||
EntityModifier value = getAttribute(attribute, config.getDouble(prefix + key + ".modifiers." + modifier, "value", 1));
|
EntityModifier value = getAttribute(attribute, config.getDouble(prefix + key + ".modifiers." + modifier, "value", 1));
|
||||||
|
log.info("9");
|
||||||
log.info("{}{}.modifiers.{}", prefix, key, modifier);
|
log.info("{}{}.modifiers.{}", prefix, key, modifier);
|
||||||
if (value == null)
|
if (value == null) {
|
||||||
|
log.info("RETURN (10)");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
log.info("11");
|
||||||
entityModifiers.add(value);
|
entityModifiers.add(value);
|
||||||
});
|
});
|
||||||
|
log.info("12");
|
||||||
MOB_TYPES.put(key, new MobType(abilities, entityModifiers));
|
MOB_TYPES.put(key, new MobType(abilities, entityModifiers));
|
||||||
|
log.info("13");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user