null pointer exception ?
ok, i am coding a server- client game like runescape and its all multithreaded, but when other people login during a thread that is supposed to make something global for all players, i get this error
http://img2.freeimagehosting.net/uploads/0ecb4d2ba7.png
it happens whenever they login before their character gets set up...i even put anti-null in the coding where its messing up
publicvoid replaceObject(int x,int y,int typeID,int orientation,int tileObjectType){//Makes Global objects
for (Player p : server.playerHandler.players){
if(p !=null){
client person = (client)p;
if((person.playerName !=null || person.playerName !="null")){
person.setObject(x, y, typeID, orientation, tileObjectType);
}
}
}
}
publicvoid setObject(int objectX,int objectY,int NewObjectID,int Face,int ObjectType){
outStream.createFrame(85);
outStream.writeByteC(objectY - (mapRegionY * 8));
outStream.writeByteC(objectX - (mapRegionX * 8));
outStream.createFrame(101);
outStream.writeByteC((ObjectType<<2) + (Face&3));
outStream.writeByte(0);
if (NewObjectID != -1){
outStream.createFrame(151);
outStream.writeByteS(0);
outStream.writeWordBigEndian(NewObjectID);
outStream.writeByteS((ObjectType<<2) + (Face&3));
//FACE: 0= WEST | -1 = NORTH | -2 = EAST | -3 = SOUTH
//ObjectType: 0-3 wall objects, 4-8 wall decoration, 9: diag. walls, 10-11 world objects, 12-21: roofs, 22: floor decoration
}
}
basically, whenever a thread is going and someone logs in i get that null pointer exception. any suggestions?
Message was edited by:
ByronTheOmnipotent
Message was edited by:
ByronTheOmnipotent

