I am trying to do the Fishing skill and keep getting a ConcurrentModificationException. I've never encountered this error before.
Code:
Starting Azure on /127.0.0.1:43594...
Loading packets...
Loaded 48 packets.
Loading item definitions...
Loading 11791 item definitions.
Loading equipment definitions...
Loaded 942 equipment definitions
Loading npc definitions...
Loaded 6 npc definitions.
Loading npc spawns...
Loaded 8 npc spawns
Loading shops...
Loaded 1 shop definitions.
Loading dialogues...
Loaded 9 dialogue definitions.
Loading options...
Loaded 2 chat option definitions.
Loading global objects...
Loaded 1 objects.
Online!
Accepted Client(127.0.0.1).
Player(Mopar:bob - 127.0.0.1) has logged in.
java.util.ConcurrentModificationException
at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:7
61)
at java.util.LinkedList$ListItr.remove(LinkedList.java:729)
at com.rs2.model.World.process(World.java:43)
at com.rs2.Server.cycle(Server.java:200)
at com.rs2.Server.run(Server.java:113)
at java.lang.Thread.run(Thread.java:619)
Unhandled packet opcode = 226 length = 15
Here's the method.
Code:
public void startFishing(int npcId) {
int level = player.getSkill().getLevelForXP((int) player.getSkill().getExp()[Skill.RUNECRAFTING]);
for (int i = 0; i < FISHING.length; i++) {
if (npcId == FISHING[i][0]) {
if (level >= FISHING[i][1]) {
int amount = player.getInventory().getItemContainer().getCount(FISHING[i][2]);
if (amount > 0) {
World.submit(new Tick(3) {
@Override
public void execute() {
player.getUpdateFlags().sendAnimation(622, 1);
player.getInventory().addItem(new Item(995, 1));
player.getActionSender().sendMessage("You catch " + ItemManager.getInstance().getItemName(317) + ".");
stop();
}
});
}
else {
player.getActionSender().sendMessage("You need a " +
ItemManager.getInstance().getItemName(FISHING[i][2]) + " to fish here.");
}
}
else {
player.getActionSender().sendMessage("You need a fishing level of " + FISHING[i][1] + " to fish here.");
return;
}
}
}
}
Any help is appreciated. Thanks.
Caused by calling a new tick inside a tick. Close.