mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
fishing treasures pt 4 (enchantments)
This commit is contained in:
parent
677e45a811
commit
2f804de36f
@ -293,22 +293,27 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
|
|||||||
fishingEnchantments.put(rarity, (new ArrayList<EnchantmentTreasure>()));
|
fishingEnchantments.put(rarity, (new ArrayList<EnchantmentTreasure>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigurationSection enchantmentSection = config.getConfigurationSection(ENCHANTMENTS_RARITY, rarity.toString());
|
ConfigurationNode enchantmentSection = getUserRootNode().getNode(ENCHANTMENTS_RARITY, rarity.toString());
|
||||||
|
|
||||||
if (enchantmentSection == null) {
|
if (enchantmentSection == null) {
|
||||||
|
mcMMO.p.getLogger().info("No enchantment information for fishing treasures, is this intentional?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String enchantmentName : enchantmentSection.getKeys(false)) {
|
try {
|
||||||
int level = getIntValue(ENCHANTMENTS_RARITY, rarity.toString(), enchantmentName);
|
for (String enchantmentName : enchantmentSection.getList(TypeToken.of(String.class))) {
|
||||||
Enchantment enchantment = EnchantmentUtils.getByName(enchantmentName);
|
int level = getIntValue(ENCHANTMENTS_RARITY, rarity.toString(), enchantmentName);
|
||||||
|
Enchantment enchantment = EnchantmentUtils.getByName(enchantmentName);
|
||||||
|
|
||||||
if (enchantment == null) {
|
if (enchantment == null) {
|
||||||
plugin.getLogger().warning("Skipping invalid enchantment in treasures.yml: " + enchantmentName);
|
mcMMO.p.getLogger().severe("Skipping invalid enchantment in treasures.yml: " + enchantmentName);
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
fishingEnchantments.get(rarity).add(new EnchantmentTreasure(enchantment, level));
|
||||||
}
|
}
|
||||||
|
} catch (ObjectMappingException e) {
|
||||||
fishingEnchantments.get(rarity).add(new EnchantmentTreasure(enchantment, level));
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user