Skip to content

Commit

Permalink
Make things a little more descriptive when loading items
Browse files Browse the repository at this point in the history
  • Loading branch information
Travja committed Nov 6, 2021
1 parent 327ce9d commit 5611a13
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/com/gotofinal/darkrise/economy/DarkRiseItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public boolean removeItem(DarkRiseItem item, boolean save) {
return false;
File file = this.itemFiles.remove(item.getId().toLowerCase());
if (file != null) {
YamlConfiguration yaml = YamlConfiguration.loadConfiguration(file);
YamlConfiguration yaml = YamlConfiguration.loadConfiguration(file);
Collection<DarkRiseItemImpl> items = yaml.getMapList("items").stream().map(m -> new DarkRiseItemImpl((Map<String, Object>) m)).collect(Collectors.toSet());
items.remove(item);
if (items.isEmpty()) {
Expand Down Expand Up @@ -134,7 +134,7 @@ public synchronized void saveItems() {
for (DarkRiseItem darkRiseItem : this.itemsById.values()) {
if (darkRiseItem.isVanilla())
continue;
File file = this.itemFiles.get(darkRiseItem.getId().toLowerCase());
File file = this.itemFiles.get(darkRiseItem.getId().toLowerCase());
Collection<DarkRiseItem> items = data.computeIfAbsent(file, k -> new ArrayList(20));
items.add(darkRiseItem/*.serialize()*/);
}
Expand Down Expand Up @@ -170,11 +170,11 @@ public void loadItems(File dataFile) {
} else if (!file.getName().endsWith(".yml")) {
continue;
}
YamlConfiguration yaml = YamlConfiguration.loadConfiguration(file);
try {
YamlConfiguration yaml = YamlConfiguration.loadConfiguration(file);
yaml.getList("items").forEach(i -> addItem(file, (DarkRiseItem) i, false));
} catch (IllegalArgumentException e) {
DarkRiseEconomy.getInstance().getLogger().warning("Could not load some items.");
} catch (Exception e) {
DarkRiseEconomy.getInstance().getLogger().warning("Could not load " + file.getName() + ": " + e.getMessage());
e.printStackTrace();
}
continue;
Expand Down

0 comments on commit 5611a13

Please sign in to comment.