This is my ShopHandler process() and it restocks items as for the delete items I don't have at the moment.
Code:
public void process() {
boolean DidUpdate = false;
for(int i = 1; i <= TotalShops; i++) {
for(int j = 0; j < MaxShopItems; j++) {
if (ShopItems[i][j] > 0) {
if (ShopItemsDelay[i][j] >= MaxShowDelay) {
if (j <= ShopItemsStandard[i] && ShopItemsN[i][j] <= ShopItemsSN[i][j]) {
if (ShopItemsN[i][j] < ShopItemsSN[i][j]) {
ShopItemsN[i][j] += 1;
DidUpdate = true;
ShopItemsDelay[i][j] = 1;
ShopItemsDelay[i][j] = 0;
DidUpdate = true;
}
} else if (ShopItemsDelay[i][j] >= MaxSpecShowDelay) {
DiscountItem(i, j);
ShopItemsDelay[i][j] = 0;
DidUpdate = true;
}
}
ShopItemsDelay[i][j]++;
}
}
if (DidUpdate == true) {
for (int k = 1; k < Config.MAX_PLAYERS; k++) {
if (Server.playerHandler.players[k] != null) {
if (Server.playerHandler.players[k].isShopping == true && Server.playerHandler.players[k].myShopId == i) {
Server.playerHandler.players[k].updateShop = true;
DidUpdate =false;
Server.playerHandler.players[k].updateshop(i);
}
}
}
DidUpdate = false;
}
}
}