Return in InventoryManager#getItem instead of iterating over the whole set
This commit is contained in:
parent
4d3a5e8756
commit
2b00363bfc
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user