Remove duplicate code between first & take

This commit is contained in:
Patrick 'Quezler' Mounier
2020-01-28 11:08:40 +01:00
parent 89d143af8f
commit 61197fe974

View File

@ -74,14 +74,14 @@ public class ItemModule extends BlockModule{
} }
public Item take(){ public Item take(){
for(int i = 0; i < items.length; i++){ Item took = first();
if(items[i] > 0){
items[i]--; if(took != null){
total--; items[first().id]--;
return content.item(i); total--;
}
} }
return null;
return took;
} }
public int get(Item item){ public int get(Item item){