Ok, I have a question about delays. In my crafting, when I cut gems, it is on a loop, but how can I make it only cut one gem every 1.5 seconds? Here is my current code now, and this doesn't work. It will only cut 1 gem instead of the 27 it is supposed to. If I remove the "System.currentTimeMillis() part, it works fine, without the 1.5 second delay. What would the correct way of doing this be? Thanks in advance.
Code:
public void craftGem(int id, int slot) {
for (int j = 0; j < 28; j++) {
if (System.currentTimeMillis() - c.craftDelay < 1500) {
if (c.getItems().playerHasItem(id,1)) {
if (c.playerLevel[c.playerCrafting] >= craftingItems[slot][2]) {
c.getItems().deleteItem(id, c.getItems().getItemSlot(id), 1);
c.getItems().addItem(craftingItems[slot][1], 1);
c.getPA().addSkillXP(craftingItems[slot][3], c.playerCrafting);
c.craftDelay = System.currentTimeMillis();
} else {
c.sendMessage("You need a crafting level of " + craftingItems[slot][2] + " to craft this gem.");
break;
}
} else {
break;
}
}
}
}