Code:
Exception in thread "main" java.lang.NullPointerException
at server.npcs.NPCHandler.process(NPCHandler.java:459)
at server.Server.main(Server.java:23)
Base: Emulous
That is my error. It all pointed the the process in NPCHandler.java. Now this only happens after about 45 mins. I added some code to it for slayer. So here is the part of my process in NPCHandler that gives me the error
Code:
if (npcs[i].isDead == true) {
if (npcs[i].actionTimer == 0 && npcs[i].applyDead == false && npcs[i].needRespawn == false) {
npcs[i].updateRequired = true;
npcs[i].facePlayer(0);
npcs[i].killedBy = getNpcKillerId(i);
npcs[i].animNumber = getDeadEmote(i); // dead emote
npcs[i].animUpdateRequired = true;
npcs[i].freezeTimer = 0;
npcs[i].applyDead = true;
npcs[i].actionTimer = 4; // delete time
} else if (npcs[i].actionTimer == 0 && npcs[i].applyDead == true && npcs[i].needRespawn == false) {
int p = npcs[i].killerId;
Client c = (Client) Server.playerHandler.players[p];
npcs[i].needRespawn = true;
npcs[i].actionTimer = getRespawnTime(i); // respawn time
dropItems(i); // npc drops items!
npcs[i].absX = npcs[i].makeX;
npcs[i].absY = npcs[i].makeY;
npcs[i].HP = npcs[i].MaxHP;
npcs[i].animNumber = 0x328;
npcs[i].updateRequired = true;
npcs[i].animUpdateRequired = true;
if (npcs[i].npcType == 1653) {
c.getPA().addSkillXP(2000, 18);
}
if (npcs[i].npcType == 1616) {
c.getPA().addSkillXP(2000, 18);
}
if (npcs[i].npcType == 1637) {
c.getPA().addSkillXP(2000, 18);
}
if (npcs[i].npcType == 1619) {
c.getPA().addSkillXP(2000, 18);
}
if (npcs[i].npcType == 1624) {
c.getPA().addSkillXP(2000, 18);
}
if (npcs[i].npcType == 1610) {
c.getPA().addSkillXP(2000, 18);
}
if (npcs[i].npcType == 1613) {
c.getPA().addSkillXP(2000, 18);
}
if (npcs[i].npcType == 1615) {
c.getPA().addSkillXP(2000, 18);
}
if (npcs[i].npcType == 2783) {
c.getPA().addSkillXP(2000, 18);
}
c.getPA().refreshSkill(18);
c.getPA().requestUpdates();
} else if (npcs[i].actionTimer == 0 && npcs[i].needRespawn == true) {
int old1 = npcs[i].npcType;
if (old1 == 1267 ||old1 == 1265) {
old1 += 1;
}
int old2 = npcs[i].makeX;
int old3 = npcs[i].makeY;
int old4 = npcs[i].heightLevel;
int old5 = npcs[i].walkingType;
int old6 = npcs[i].MaxHP;
int old7 = npcs[i].maxHit;
int old8 = npcs[i].attack;
int old9 = npcs[i].defence;
npcs[i] = null;
newNPC(old1, old2, old3, old4, old5, old6, old7, old8, old9);
}
}
I always get the errors around the part where I have it give slayer xp. Now I am not sure why this works for awhile then aroun the 45 min mark I get the above error. Any ideas?