@SuppressWarnings("deprecation")
 public void remoteDonations(Player player) {
   SuperNPlayer snplayer = SuperNManager.get(player);
   PlayerInventory inv = player.getInventory();
   ItemStack[] items = inv.getContents();
   double delta = 0;
   invCheck:
   for (Material mat : SNConfigHandler.priestDonationMap.keySet()) {
     for (ItemStack itemStack : items) {
       if (itemStack != null) {
         if (itemStack.getType().equals(mat)) {
           delta = SNConfigHandler.priestDonationMap.get(mat);
           if (itemStack.getAmount() == 1) {
             inv.clear(inv.first(itemStack.getType()));
           } else {
             itemStack.setAmount(itemStack.getAmount() - 1);
           }
           break invCheck;
         }
       }
     }
   }
   if (delta == 0) {
     SuperNManager.sendMessage(
         snplayer, "The Church only accepts donations of Bread, Fish, Grilled Pork and Apples.");
   } else {
     player.updateInventory();
     SuperNManager.sendMessage(snplayer, "You receive some power for your remote donations.");
     SuperNManager.alterPower(snplayer, delta * .5, "Donations!");
   }
 }
 public static void emptyWaterBottle(Player player) {
   PlayerInventory inventory = player.getInventory();
   int index = inventory.first(new ItemStack(Material.POTION));
   if (index != -1) {
     ItemStack item = inventory.getItem(index);
     if (item.getAmount() == 1) {
       inventory.setItem(index, new ItemStack(Material.GLASS_BOTTLE));
     } else {
       item.setAmount(item.getAmount() - 1);
       inventory.setItem(index, item);
       HashMap<Integer, ItemStack> leftover =
           inventory.addItem(new ItemStack(Material.GLASS_BOTTLE));
       for (int left : leftover.keySet()) {
         player.getWorld().dropItemNaturally(player.getLocation(), leftover.get(left));
       }
     }
   }
 }
  private void fillBottle() {
    PlayerInventory inventory = player.getInventory();
    if (inventory.contains(Material.GLASS_BOTTLE)) {
      int index = inventory.first(Material.GLASS_BOTTLE);
      ItemStack item = inventory.getItem(index);
      if (item.getAmount() == 1) {
        inventory.setItem(index, new ItemStack(Material.POTION));
      } else {
        item.setAmount(item.getAmount() - 1);
        inventory.setItem(index, item);
        HashMap<Integer, ItemStack> leftover = inventory.addItem(new ItemStack(Material.POTION));
        for (int left : leftover.keySet()) {
          player.getWorld().dropItemNaturally(player.getLocation(), leftover.get(left));
        }
      }
    }

    remove();
  }