Alright so i followed a copy/paste guide to this minigame since i just wanted it in my server but it didnt have the rounds executed or rounds after the first one blah blah i fixed all that but now im having a problem. when i reach round 8 the server .bat reads an error and than every few seconds (the wait time between waves) it spawns that wave again so i just get piled with zombies. this is the error im recieving -
error-
Code:
[2/19/12 10:24 AM]: at server.model.minigames.ZombieMiniGame.spawnNextRound(
ZombieMiniGame.java:26)
[2/19/12 10:24 AM]: at server.model.npcs.NPCHandler$2.execute(NPCHandler.jav
a:1423)
[2/19/12 10:24 AM]: at server.event.EventContainer.execute(EventContainer.ja
va:51)
[2/19/12 10:24 AM]: at server.event.EventManager.run(EventManager.java:101)
[2/19/12 10:24 AM]: at java.lang.Thread.run(Unknown Source)
[2/19/12 10:24 AM]: Admin - actionbutton: 29138
[2/19/12 10:24 AM]: java.lang.ArrayIndexOutOfBoundsException: 8
and these are the lines that are apparently in question, but im not understanding how
NPChandler-
Code:
private void killedZombie(int i) {
final Client c2 = (Client)Server.playerHandler.players[npcs[i].spawnedBy];
c2.ZombiesKilled++;
//System.out.println("To kill: " + c2.ZombiesToKill + " killed: " + c2.ZombiesKilled);
if (c2.ZombiesKilled == c2.ZombiesToKill) {
//c2.sendMessage("STARTING EVENT");
c2.RoundId++;
EventManager.getSingleton().addEvent(new Event() {
public void execute(EventContainer c) {
if (c2 != null) {
Server.zombieMiniGame.spawnNextRound(c2);
}
c.stop();
}
}, 7500);
}
}
EventCOntainer -
Code:
public void execute() {
this.lastRun = System.currentTimeMillis();
this.event.execute(this);
}
EventManager -
Code:
for (EventContainer container : events) {
if (container.isRunning()) {
if ((System.currentTimeMillis() - container.getLastRun()) >= container
.getTick()) {
try {
container.execute();
} catch (Exception e){e.printStackTrace();}
}
if (container.getTick() < waitFor || waitFor == -1) {
waitFor = container.getTick();
}
} else {
// add to remove list
remove.add(container);
}
}
So yea im not sure what to do with this because last time i got this error (i think it was this type of error) i increased the array limit or something (been a year since ive coded) but idk. Thanks in advance to any help!