示例#1
0
 /**
  * Checks if the player has a certain amount (or more) of a specified item
  *
  * @param item - Specified item
  * @param amount - Amount to check for
  * @return boolean
  */
 public boolean hasItem(Item item, int amount) {
   if (item.getStack() >= amount) {
     return true;
   } else {
     return false;
   }
 }
示例#2
0
 /**
  * Removes the amount of items to its stack
  *
  * @param item - Item to control
  * @param amount - Amount to decrease by
  */
 public void removeItem(Item item, int amount) {
   item.setStack(item.getStack() - amount);
   Sys.print(amount + " " + item.getName() + " was removed from your inventory!");
 }
示例#3
0
 /**
  * Adds the amount of items to its stack
  *
  * @param item - Item to control
  * @param amount - Amount to increase by
  */
 public void addItem(Item item, int amount) {
   item.setStack(item.getStack() + amount);
   Sys.print(amount + " " + item.getName() + " was added to your inventory!");
 }