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