I've run into another error (not compilation error, this time)
I am trying to make it so that if you use Make 5, it just loops the event 5 times. Here is my code:
Code:
static int counter = 0;
static int stepcounter = 0;
public static void fletch(final int amount, Client client) {
final Client c = client;
if (c.fletchShafts == 1) {
if (amount > 0) {
if (c.GetXItemsInBag(1511) > 0
&& c.GetXItemsInBag(1511) >= amount) {
fletchShafts(amount, c);
}
}
}
}
public static void fletchShafts(final int amount, Client client) {
final Client c = client;
c.setAnimation(1248);
c.deleteItem(1511, 1);
EventManager.getSingleton().addEvent(new Event() {
public void execute(EventContainer ec) {
switch (stepcounter) {
case 3:
counter++;
ec.stop();
c.addItem(52, 15);
c.sM("You carefully cut the wood into 15 arrow shafts.");
c.addSkillXP(5 * Server.EXP_MULTIPLIER, 9);
stepcounter = 0;
if(amount > counter) fletchShafts(amount, c);
break;
case 2:
stepcounter++;
break;
case 1:
stepcounter++;
break;
case 0:
stepcounter++;
break;
}
}
}, 930);
}
But I get this error when it reaches the second log (the first log gets fletched perfectly):
Code:
Exception in thread "Thread-0" java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
at java.util.AbstractList$Itr.next(Unknown Source)
at com.rs2.event.EventManager.run(EventManager.java:96)
at java.lang.Thread.run(Unknown Source)