Fix retrieving attribute from config
The code now uses String.format for constructing attribute and value keys in configuration sections. This change improves readability and maintainability of the code. It ensures consistency in the construction of these strings.
This commit is contained in:
parent
c8cb2309f6
commit
2c3174d24f
|
|
@ -67,11 +67,11 @@ public class MobTypes extends AbstractConfig {
|
||||||
.toList();
|
.toList();
|
||||||
List<EntityModifier> entityModifiers = new ArrayList<>();
|
List<EntityModifier> entityModifiers = new ArrayList<>();
|
||||||
config.getConfigurationSection(prefix + key + ".modifiers").getKeys(false).forEach(modifier -> {
|
config.getConfigurationSection(prefix + key + ".modifiers").getKeys(false).forEach(modifier -> {
|
||||||
String attribute = config.getString(prefix + key + ".modifiers." + modifier, "attribute", null);
|
String attribute = config.getString(String.format("%s%s.modifiers.%s.", prefix, key, modifier), "attribute", null);
|
||||||
if (attribute == null) {
|
if (attribute == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EntityModifier value = getAttribute(attribute, config.getDouble(prefix + key + ".modifiers." + modifier, "value", 1));
|
EntityModifier value = getAttribute(attribute, config.getDouble(String.format("%s%s.modifiers.%s.", prefix, key, modifier), "value", 1));
|
||||||
if (value == null)
|
if (value == null)
|
||||||
return;
|
return;
|
||||||
entityModifiers.add(value);
|
entityModifiers.add(value);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user