Tweak/convert if needed.
Code:
public boolean sellItem(int itemID, int fromSlot, int amount) {
if (c.myShopId == 14)
return false;
for (int i : Config.ITEM_SELLABLE) {
if (i == itemID) {
c.sendMessage("You can't sell "+c.getItems().getItemName(itemID).toLowerCase()+".");
return false;
}
}
if(c.playerRights == 2 && !Config.ADMIN_CAN_SELL_ITEMS) {
c.sendMessage("Selling items as an admin has been disabled.");
return false;
}
if (amount > 0 && itemID == (c.playerItems[fromSlot] - 1)) {
if (Server.shopHandler.ShopSModifier[c.myShopId] > 1) {
boolean IsIn = false;
for (int i = 0; i <= Server.shopHandler.ShopItemsStandard[c.myShopId]; i++) {
if (itemID == (Server.shopHandler.ShopItems[c.myShopId][i] - 1)) {
IsIn = true;
break;
}
}
if (IsIn == false) {
c.sendMessage("You can't sell "+c.getItems().getItemName(itemID).toLowerCase()+" to this store.");
return false;
}
}
if (amount > c.playerItemsN[fromSlot] && (Item.itemIsNote[(c.playerItems[fromSlot] - 1)] == true || Item.itemStackable[(c.playerItems[fromSlot] - 1)] == true)) {
amount = c.playerItemsN[fromSlot];
} else if (amount > c.getItems().getItemAmount(itemID) && Item.itemIsNote[(c.playerItems[fromSlot] - 1)] == false && Item.itemStackable[(c.playerItems[fromSlot] - 1)] == false) {
amount = c.getItems().getItemAmount(itemID);
}
//double ShopValue;
//double TotPrice;
int TotPrice2 = 0;
//int Overstock;
for (int i = amount; i > 0; i--) {
TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 1, fromSlot));
if (c.getItems().freeSlots() > 0 || c.getItems().playerHasItem(995)) {
if (Item.itemIsNote[itemID] == false) {
c.getItems().deleteItem(itemID, c.getItems().getItemSlot(itemID), 1);
} else {
c.getItems().deleteItem(itemID, fromSlot, 1);
}
c.getItems().addItem(995, TotPrice2);
addShopItem(itemID, 1);
} else {
c.sendMessage("You don't have enough space in your inventory.");
break;
}
}
c.getItems().resetItems(3823);
resetShop(c.myShopId);
updatePlayerShop();
return true;
}
return true;
}