Code legibility change.

Dieser Commit ist enthalten in:
Leandro 2021-07-04 22:57:40 -03:00
Ursprung 5fb844f4b7
Commit b91aa3724f

Datei anzeigen

@ -27,19 +27,22 @@ public class InventoryUtils {
private static final Map<String, ItemStack> uiItem = new HashMap<>(); private static final Map<String, ItemStack> uiItem = new HashMap<>();
public static int uiGetLocation(String category, int slot) { public static int uiGetLocation(String category, int slot) {
// Try to use the cached value first; then the config; then the given default. // Try to use the cached value first.
if (!uiLocation.containsKey(category)) { if (uiLocation.containsKey(category)) return uiLocation.get(category);
// Try to get the value from the config file.
if (HeadDB.getInstance().getCfg().contains("ui.category." + category + ".location")) { if (HeadDB.getInstance().getCfg().contains("ui.category." + category + ".location")) {
uiLocation.put(category, HeadDB.getInstance().getCfg().getInt("ui.category." + category + ".location")); uiLocation.put(category, HeadDB.getInstance().getCfg().getInt("ui.category." + category + ".location"));
} else { uiLocation.get(category);
}
// No valid value in the config file, return the given default.
uiLocation.put(category, slot); uiLocation.put(category, slot);
} return slot;
}
return uiLocation.get(category);
} }
public static ItemStack uiGetItem(String category, ItemStack item) { public static ItemStack uiGetItem(String category, ItemStack item) {
// Try to use the cached value first. // Try to use the cached item first.
if (uiItem.containsKey(category)) return uiItem.get(category); if (uiItem.containsKey(category)) return uiItem.get(category);
// Try to get a head from the config file. // Try to get a head from the config file.