Makes it possible to edit reforgeAbleItems globally #17

This commit is contained in:
2023-01-11 01:54:52 +01:00
parent 8423eabc57
commit bd00a59d08
4 changed files with 19 additions and 13 deletions

View File

@ -92,6 +92,11 @@ public class GlobalSettings {
defaultNPCSettings.put(npcSetting, newValue);
}
save();
if (npcSetting == NPCSetting.REFORGE_ABLE_ITEMS) {
loadReforgeAbleItems();
} else if (npcSetting == NPCSetting.ENCHANTMENT_BLOCKLIST) {
loadEnchantmentBlocklist();
}
}
/**
@ -482,9 +487,23 @@ public class GlobalSettings {
defaultNPCSettings.put(setting, root.getRaw(setting.getPath()));
}
}
loadReforgeAbleItems();
loadEnchantmentBlocklist();
}
/**
* Loads reforgeAble items from the current value
*/
private void loadReforgeAbleItems() {
defaultReforgeAbleMaterials.clear();
defaultReforgeAbleMaterials.addAll(NPCSettings.getReforgeAbleItems(ConfigHelper.asStringList(
defaultNPCSettings.get(NPCSetting.REFORGE_ABLE_ITEMS))));
}
/**
* Loads the enchantment blocklist from the current value
*/
private void loadEnchantmentBlocklist() {
defaultEnchantmentBlocklist.clear();
defaultEnchantmentBlocklist.addAll(NPCSettings.getEnchantmentBlocklist(ConfigHelper.asStringList(
defaultNPCSettings.get(NPCSetting.ENCHANTMENT_BLOCKLIST))));