Changed getStock to only return the actual stock they have left instead of the total amount of items left (and protected it)
This commit is contained in:
@@ -84,8 +84,16 @@ public class PlayerShop {
|
||||
return playerShop;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return total amount of purchases left until the shop can't sell/buy anymore
|
||||
*/
|
||||
public int getRemainingStock() {
|
||||
return InventoryUtils.countItems(getInventory(), getItemStack());
|
||||
int totalItems = InventoryUtils.countItems(getInventory(), getItemStack());
|
||||
if (totalItems == 0)
|
||||
return 0;
|
||||
if (getAmount() == 0)
|
||||
return 0;
|
||||
return totalItems / getAmount();
|
||||
}
|
||||
|
||||
public int getRemainingSpace() {
|
||||
|
||||
Reference in New Issue
Block a user