mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-02-01 11:11:21 +01:00
add error handle for set manager
This commit is contained in:
parent
a4612a1c82
commit
6443f85b4b
@ -3,12 +3,14 @@ package net.Indyuce.mmoitems.manager;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
import net.Indyuce.mmoitems.api.ItemSet;
|
||||
|
||||
public class SetManager {
|
||||
private Map<String, ItemSet> itemSets = new HashMap<>();
|
||||
private final Map<String, ItemSet> itemSets = new HashMap<>();
|
||||
|
||||
public SetManager() {
|
||||
reload();
|
||||
@ -17,10 +19,13 @@ public class SetManager {
|
||||
public void reload() {
|
||||
ConfigFile config = new ConfigFile("item-sets");
|
||||
|
||||
// reload item sets and cache them into a map
|
||||
itemSets.clear();
|
||||
for (String id : config.getConfig().getKeys(false))
|
||||
itemSets.put(id, new ItemSet(config.getConfig().getConfigurationSection(id)));
|
||||
try {
|
||||
itemSets.put(id, new ItemSet(config.getConfig().getConfigurationSection(id)));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOItems.plugin.getLogger().log(Level.WARNING, "Could not load item set '" + id + "': " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<ItemSet> getAll() {
|
||||
|
Loading…
Reference in New Issue
Block a user