Return in InventoryManager#getItem instead of iterating over the whole set

This commit is contained in:
ArcticZeroo 2018-01-09 19:30:00 -05:00 committed by Alexander Meech
parent 4d3a5e8756
commit 2b00363bfc

View File

@ -136,17 +136,17 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
public Item getItem(String itemName)
{
Item item = null;
for (Map.Entry<String, Item> entry : _items.entrySet())
{
String name = entry.getKey();
if (name.equalsIgnoreCase(itemName))
item = entry.getValue();
{
return entry.getValue();
}
}
return item;
return null;
}
public void addItemToInventoryForOffline(final Callback<Boolean> callback, final UUID uuid, final String item, final int count)