Hello, im trying to compile few .java files but i'm geting error message:

GraphicsHandler.java:62: ';' expected
for (Player p : server.playerHandler.players) {
GraphicsHandler.java:67: illegal start of expression
}}}
I just don't know what to do...


----------------------There is my GraphicsHandler.java--------------
public class GraphicsHandler
{


public static int[] GFXspot = new int[5001];
public static int[] castID = new int[5001];
public static int[] moveID = new int[5001];
public static int[] endID = new int[5001];
public static int[] gfxX = new int[5001];
public static int[] gfxY = new int[5001];
public static int[] offX = new int[5001];
public static int[] offY = new int[5001];
public static int[] gfxA = new int[5001];
public static int[] gfxS = new int[5001];
public static int[] gfxSH = new int[5001];
public static int[] gfxFH = new int[5001];
public static int[] targetX = new int[5001];
public static int[] targetY = new int[5001];
public static int[] lockOn = new int[5001];


public GraphicsHandler() {
for (int i = 0; i <= 5000; i++)  {
GFXspot = 0;
castID = 0;
moveID = 0;
endID = 0;
gfxX = 0;
gfxY = 0;
offX = 0;
offY = 0;
gfxA = 0;
gfxS = 0;
gfxSH = 0;
gfxFH = 0;
targetX = 0;
targetY = 0;
lockOn = 0;
}}


public static void addSpell(int castId, int casterY, int casterX, int offsetY, int offsetX, int angle, int speed, int movegfxID,int startHeight, int endHeight, int MageAttackIndex, int finishID, int enemyY, int enemyX) {
for (int i = 0; i <= 5000; i++) {
if(GFXspot == 0) {
GFXspot = castId;
castID = castId;
moveID = movegfxID;
endID = finishID;
gfxX = casterX;
gfxY = casterY;
offX = offsetX;
offY = offsetY;
gfxA = angle;
gfxS = speed;
gfxSH = startHeight;
gfxFH = endHeight;
targetX = enemyX;
targetY = enemyY;
lockOn = MageAttackIndex;
if (GFXspot != -1)
createSpell(castID, gfxY, gfxX, offY, offX, gfxA, gfxS, moveID, gfxSH, gfxFH, lockOn, endID, targetY, targetX);
}}}


public static void createSpell(int castId, int casterY, int casterX, int offsetY, int offsetX, int angle, int speed, int movegfxID,int startHeight, int endHeight, int MageAttackIndex, int finishID, int enemyY, int enemyX) {
for (Player p : server.playerHandler.players) {
if(p != null)  {
client person = (client)p;
if((person.playerName != null || person.playerName != "null"))
person.firespell(castId, casterY, casterX, offsetY, offsetX, angle, speed, movegfxID, startHeight, endHeight, MageAttackIndex, finishID, enemyY, enemyX);
}}}


public static void removeGFX(int castId, int enemyX, int enemyY) {
for (int i = 0; i <= 5000; i++)  {
if(GFXspot == castId && targetX == enemyX && targetY == enemyY) {
GFXspot = 0;
castID = 0;
moveID = 0;
endID = 0;
gfxX = 0;
gfxY = 0;
offX = 0;
offY = 0;
gfxA = 0;
gfxS = 0;
gfxSH = 0;
gfxFH = 0;
targetX = 0;
targetY = 0;
lockOn = 0; //-1
}}}}
--------------------------------end---------------------------------------


----------and there is my playerhandler.java if needed-------------
import java.io.*;
import java.util.Calendar;
import java.util.GregorianCalendar;


public class PlayerHandler {


// Remark: the player structures are just a temporary solution for now
// Later we will avoid looping through all the players for each player
// by making use of a hash table maybe based on map regions (8x8 granularity should be ok)
public static final int maxPlayers = 512;
public static Player players[] = new Player[maxPlayers];
public int playerSlotSearchStart = 1;           // where we start searching at when adding a new player
public static String kickNick = "";
public static boolean kickAllPlayers = false;
public static String messageToAll = "";
public static int playerCount=0;
public static String playersCurrentlyOn[] = new String[maxPlayers];
public static boolean updateAnnounced;
public static boolean updateRunning;
public static int updateSeconds;
public static long updateStartTime;


PlayerHandler() {
for(int i = 0; i < maxPlayers; i++) {
players = null;
}
}


// a new client connected
public void newPlayerClient(java.net.Socket s, String connectedFrom) {
// first, search for a free slot
//int slot = -1, i = playerSlotSearchStart;
int slot = -1, i = 1;
do {
if(players == null) {
slot = i;
break;
}
i++;
if(i >= maxPlayers) i = 0;      // wrap around
//      } while(i != playerSlotSearchStart);
} while(i <= maxPlayers);


client newClient = new client(s, slot);
newClient.handler = this;
(new Thread(newClient)).start();
if(slot == -1) return;      // no free slot found - world is full
players[slot] = newClient;
players[slot].connectedFrom = connectedFrom;


// start at next slot when issuing the next search to speed it up
playerSlotSearchStart = slot + 1;
if(playerSlotSearchStart > maxPlayers) playerSlotSearchStart = 1;
// Note that we don't use slot 0 because playerId zero does not function
// properly with the client.
}


public void destruct() {
for(int i = 0; i < maxPlayers; i++) {
if(players == null) continue;
players.destruct();
players = null;
}
}


public static int getPlayerCount() {
return playerCount;
}


public void updatePlayerNames(){
playerCount=0;
for(int i = 0; i < maxPlayers; i++) {
if(players != null) {
playersCurrentlyOn = players.playerName;
playerCount++;
}
else
playersCurrentlyOn = "";
}
}


public static boolean isPlayerOn(String playerName) {
for(int i = 0; i < maxPlayers; i++) {
if(playersCurrentlyOn != null){
if(playersCurrentlyOn.equalsIgnoreCase(playerName)) return true;
}
}
return false;
}


public void process() {
updatePlayerNames();
if (messageToAll.length() > 0) {
int msgTo=1;
do {
if(players[msgTo] != null) {
players[msgTo].globalMessage=messageToAll;
}
msgTo++;
} while(msgTo < maxPlayers);
messageToAll="";
}
if (kickAllPlayers == true) {
int kickID = 1;
do {
if(players[kickID] != null) {
players[kickID].isKicked = true;
}
kickID++;
} while(kickID < maxPlayers);
kickAllPlayers = false;
}


// at first, parse all the incoming data
// this has to be seperated from the outgoing part because we have to keep all the player data
// static, so each client gets exactly the same and not the one clients are ahead in time
// than the other ones.
for(int i = 0; i < maxPlayers; i++) {
if(players == null || !players.isActive) continue;


players.actionAmount--;


players.preProcessing();
while(players.process());
players.postProcessing();


players.getNextPlayerMovement();


if(players.playerName.equalsIgnoreCase(kickNick))
{
players.kick();
kickNick="";
}


if(players.disconnected) {
if (players.savefile == true) {
if(saveGame(players)){
System.out.println("Game saved for player "+players.playerName);
} else {
System.out.println("Could not save for "+players.playerName);
};
} else {
System.out.println("Did not save for "+players.playerName);
}
removePlayer(players);
players = null;
}
}


// loop through all players and do the updating stuff
for(int i = 0; i < maxPlayers; i++) {
if(players == null || !players.isActive) continue;


Calendar cal = new GregorianCalendar();
int day = cal.get(Calendar.DAY_OF_MONTH);
int month = cal.get(Calendar.MONTH);
int year = cal.get(Calendar.YEAR);
int calc = ((year * 10000) + (month * 100) + day);
players.playerLastLogin = calc;
if(players.disconnected) {
if (players.savefile == true) {
if(saveGame(players)) {
System.out.println("Game saved for player "+players.playerName);
} else {
System.out.println("Could not save for "+players.playerName);
};
} else {
System.out.println("Did not save for "+players.playerName);
}
removePlayer(players);
players = null;
} else {
if(!players.initialized) {
players.initialize();
players.initialized = true;
} else {
players.update();
}
}
}


if (updateRunning && !updateAnnounced) {
updateAnnounced = true;
}


if (updateRunning && System.currentTimeMillis() - updateStartTime > (updateSeconds*1000)) {
kickAllPlayers = true;
server.ShutDown = true;
}


// post processing
for(int i = 0; i < maxPlayers; i++) {
if(players == null || !players.isActive) continue;


players.clearUpdateFlags();
}
}


public void updateNPC(Player plr, stream str) {
updateBlock.currentOffset = 0;


str.createFrameVarSizeWord(65);
str.initBitAccess();


str.writeBits(8, plr.npcListSize);
int size = plr.npcListSize;
plr.npcListSize = 0;
for(int i = 0; i < size; i++) {
if(plr.RebuildNPCList == false && plr.withinDistance(plr.npcList) == true) {
plr.npcList.updateNPCMovement(str);
plr.npcList.appendNPCUpdateBlock(updateBlock);
plr.npcList[plr.npcListSize++] = plr.npcList;
} else {
int id = plr.npcList.npcId;
plr.npcInListBitmap[id>>3] &= ~(1 << (id&7));     // clear the flag
str.writeBits(1, 1);
str.writeBits(2, 3);        // tells client to remove this npc from list
}
}


// iterate through all npcs to check whether there's new npcs to add
for(int i = 0; i < NPCHandler.maxNPCs; i++) {
if(server.npcHandler.npcs != null) {
int id = server.npcHandler.npcs.npcId;
if (plr.RebuildNPCList == false && (plr.npcInListBitmap[id>>3]&(1 << (id&7))) != 0) {
// npc already in npcList
} else if (plr.withinDistance(server.npcHandler.npcs) == false) {
// out of sight
} else {
plr.addNewNPC(server.npcHandler.npcs, str, updateBlock);
}
}
}


plr.RebuildNPCList = false;


if(updateBlock.currentOffset > 0) {
str.writeBits(14, 16383);   // magic EOF - needed only when npc updateblock follows
str.finishBitAccess();


// append update block
str.writeBytes(updateBlock.buffer, updateBlock.currentOffset, 0);
} else {
str.finishBitAccess();
}
str.endFrameVarSizeWord();
}


private stream updateBlock = new stream(new byte[10000]);
// should actually be moved to client.java because it's very client specific
public void updatePlayer(Player plr, stream str) {
updateBlock.currentOffset = 0;


if (updateRunning && !updateAnnounced) {
str.createFrame(114);
str.writeWordBigEndian(updateSeconds*50/30);
}


// update thisPlayer
plr.updateThisPlayerMovement(str);      // handles walking/running and teleporting
// do NOT send chat text back to thisPlayer!
boolean saveChatTextUpdate = plr.chatTextUpdateRequired;
plr.chatTextUpdateRequired = false;
plr.appendPlayerUpdateBlock(updateBlock);
plr.chatTextUpdateRequired = saveChatTextUpdate;


str.writeBits(8, plr.playerListSize);
int size = plr.playerListSize;


// update/remove players that are already in the playerList
plr.playerListSize = 0;     // we're going to rebuild the list right away
for(int i = 0; i < size; i++) {
// this update packet does not support teleporting of other players directly
// instead we're going to remove this player here and readd it right away below
if(plr.didTeleport == false && plr.withinDistance(plr.playerList) == true) {
plr.playerList.updatePlayerMovement(str);
plr.playerList.appendPlayerUpdateBlock(updateBlock);
plr.playerList[plr.playerListSize++] = plr.playerList;
} else {
int id = plr.playerList.playerId;
plr.playerInListBitmap[id>>3] &= ~(1 << (id&7));      // clear the flag
str.writeBits(1, 1);
str.writeBits(2, 3);        // tells client to remove this char from list
}
}


// iterate through all players to check whether there's new players to add
for(int i = 0; i < maxPlayers; i++) {
if(players == null || players.isActive == false || players == plr) {
//not existing, not active or you are that player
} else {
int id = players.playerId;
if(plr.didTeleport == false && (plr.playerInListBitmap[id>>3]&(1 << (id&7))) != 0) {
// player already in playerList
} else if(plr.withinDistance(players) == false) {
// out of sight
} else {
plr.addNewPlayer(players, str, updateBlock);
}
}
}


if(updateBlock.currentOffset > 0) {
str.writeBits(11, 2047);    // magic EOF - needed only when player updateblock follows
str.finishBitAccess();


// append update block
str.writeBytes(updateBlock.buffer, updateBlock.currentOffset, 0);
} else {
str.finishBitAccess();
}
str.endFrameVarSizeWord();
}


public int lastchatid = 1; //PM System


private void removePlayer(Player plr) {
if(plr.Privatechat != 2) { //PM System
for(int i = 1; i < maxPlayers; i++) {
if (players == null || players.isActive == false) continue;
players.pmupdate(plr.playerId, 0);
}
}
// anything can be done here like unlinking this player structure from any of the other existing structures
plr.destruct();
}


public boolean saveGame(Player plr) {
BufferedWriter characterfile = null;
plr.playerLook[0] = plr.pGender;
plr.playerLook[1] = plr.pHead;
plr.playerLook[2] = plr.pBeard;
plr.playerLook[3] = plr.pTorso;
plr.playerLook[4] = plr.pArms;
plr.playerLook[5] = plr.pHands;
plr.playerLook[6] = plr.pLegs;
plr.playerLook[7] = plr.pFeet;
plr.playerLook[8] = plr.pHairC;
plr.playerLook[9] = plr.pTorsoC;
plr.playerLook[10] = plr.pLegsC;
plr.playerLook[11] = plr.pFeetC;
plr.playerLook[12] = plr.pSkinC;
plr.playerLook[13] = plr.apset;
try {
characterfile = new BufferedWriter(new FileWriter("./Accounts/"+plr.playerName+".txt"));
/*ACCOUNT*/
characterfile.write("[ACCOUNT]", 0, 9);
characterfile.newLine();
characterfile.write("character-username = ", 0, 21);
characterfile.write(plr.playerName, 0, plr.playerName.length());
characterfile.newLine();
characterfile.write("character-password = ", 0, 21);
characterfile.write(plr.playerPass, 0, plr.playerPass.length());
characterfile.newLine();
characterfile.newLine();
/*CHARACTER*/
characterfile.write("[CHARACTER]", 0, 11);
characterfile.newLine();
characterfile.write("character-height = ", 0, 19);
characterfile.write(Integer.toString(plr.heightLevel), 0, Integer.toString(plr.heightLevel).length());
characterfile.newLine();
characterfile.write("character-posx = ", 0, 17);
characterfile.write(Integer.toString(plr.absX), 0, Integer.toString(plr.absX).length());
characterfile.newLine();
characterfile.write("character-posy = ", 0, 17);
characterfile.write(Integer.toString(plr.absY), 0, Integer.toString(plr.absY).length());
characterfile.newLine();
characterfile.write("character-rights = ", 0, 19);
characterfile.write(Integer.toString(plr.playerRights), 0, Integer.toString(plr.playerRights).length());
characterfile.newLine();
characterfile.write("character-ismember = ", 0, 21);
characterfile.write(Integer.toString(plr.playerIsMember), 0, Integer.toString(plr.playerIsMember).length());
characterfile.newLine();
characterfile.write("character-messages = ", 0, 21);
characterfile.write(Integer.toString(plr.playerMessages), 0, Integer.toString(plr.playerMessages).length());
characterfile.newLine();
characterfile.write("character-lastconnection = ", 0, 27);
characterfile.write(plr.playerLastConnect, 0, plr.playerLastConnect.length());
characterfile.newLine();
characterfile.write("character-lastlogin = ", 0, 22);
characterfile.write(Integer.toString(plr.playerLastLogin), 0, Integer.toString(plr.playerLastLogin).length());
characterfile.newLine();
characterfile.write("character-energy = ", 0, 19);
characterfile.write(Integer.toString(plr.playerEnergy), 0, Integer.toString(plr.playerEnergy).length());
characterfile.newLine();
characterfile.write("character-gametime = ", 0, 21);
characterfile.write(Integer.toString(plr.playerGameTime), 0, Integer.toString(plr.playerGameTime).length());
characterfile.newLine();
characterfile.write("character-gamecount = ", 0, 22);
characterfile.write(Integer.toString(plr.playerGameCount), 0, Integer.toString(plr.playerGameCount).length());
characterfile.newLine();
characterfile.newLine();
/*EQUIPMENT*/
characterfile.write("[EQUIPMENT]", 0, 11);
characterfile.newLine();
for (int i = 0; i < plr.playerEquipment.length; i++) {
characterfile.write("character-equip = ", 0, 18);
characterfile.write(Integer.toString(i), 0, Integer.toString(i).length());
characterfile.write("   ", 0, 1);
characterfile.write(Integer.toString(plr.playerEquipment), 0, Integer.toString(plr.playerEquipment).length());
characterfile.write("   ", 0, 1);
characterfile.write(Integer.toString(plr.playerEquipmentN), 0, Integer.toString(plr.playerEquipmentN).length());
characterfile.write("   ", 0, 1);
characterfile.newLine();
}
characterfile.newLine();
/*LOOK*/
characterfile.write("[LOOK]", 0, 6);
characterfile.newLine();
for (int i = 0; i < plr.playerLook.length; i++) {
characterfile.write("character-look = ", 0, 17);
characterfile.write(Integer.toString(i), 0, Integer.toString(i).length());
characterfile.write("   ", 0, 1);
characterfile.write(Integer.toString(plr.playerLook), 0, Integer.toString(plr.playerLook).length());
characterfile.newLine();
}
characterfile.newLine();
/*SKILLS*/
characterfile.write("[SKILLS]", 0, 8);
characterfile.newLine();
for (int i = 0; i < plr.playerLevel.length; i++) {
characterfile.write("character-skill = ", 0, 18);
characterfile.write(Integer.toString(i), 0, Integer.toString(i).length());
characterfile.write("   ", 0, 1);
characterfile.write(Integer.toString(plr.playerLevel), 0, Integer.toString(plr.playerLevel).length());
characterfile.write("   ", 0, 1);
characterfile.write(Integer.toString(plr.playerXP), 0, Integer.toString(plr.playerXP).length());
characterfile.newLine();
}
characterfile.newLine();
/*ITEMS*/
characterfile.write("[ITEMS]", 0, 7);
characterfile.newLine();
for (int i = 0; i < plr.playerItems.length; i++) {
if (plr.playerItems > 0) {
characterfile.write("character-item = ", 0, 17);
characterfile.write(Integer.toString(i), 0, Integer.toString(i).length());
characterfile.write("   ", 0, 1);
characterfile.write(Integer.toString(plr.playerItems), 0, Integer.toString(plr.playerItems).length());
characterfile.write("   ", 0, 1);
characterfile.write(Integer.toString(plr.playerItemsN), 0, Integer.toString(plr.playerItemsN).length());
characterfile.newLine();
}
}
characterfile.newLine();
/*BANK*/
characterfile.write("[BANK]", 0, 6);
characterfile.newLine();
for (int i = 0; i < plr.bankItems.length; i++) {
if (plr.bankItems > 0) {
characterfile.write("character-bank = ", 0, 17);
characterfile.write(Integer.toString(i), 0, Integer.toString(i).length());
characterfile.write("   ", 0, 1);
characterfile.write(Integer.toString(plr.bankItems), 0, Integer.toString(plr.bankItems).length());
characterfile.write("   ", 0, 1);
characterfile.write(Integer.toString(plr.bankItemsN), 0, Integer.toString(plr.bankItemsN).length());
characterfile.newLine();
}
}
characterfile.newLine();
/*FRIENDS*/
characterfile.write("[FRIENDS]", 0, 9);
characterfile.newLine();
for (int i = 0; i < plr.friends.length; i++) {
if (plr.friends > 0) {
characterfile.write("character-friend = ", 0, 19);
characterfile.write(Integer.toString(i), 0, Integer.toString(i).length());
characterfile.write("   ", 0, 1);
characterfile.write(Long.toString(plr.friends), 0, Long.toString(plr.friends).length());
characterfile.newLine();
}
}
characterfile.newLine();
/*IGNORES*/
characterfile.write("[IGNORES]", 0, 9);
characterfile.newLine();
for (int i = 0; i < plr.ignores.length; i++) {
if (plr.ignores > 0) {
characterfile.write("character-ignore = ", 0, 19);
characterfile.write(Integer.toString(i), 0, Integer.toString(i).length());
characterfile.write("   ", 0, 1);
characterfile.write(Long.toString(plr.ignores), 0, Long.toString(plr.ignores).length());
characterfile.newLine();
}
}
characterfile.newLine();
/*EOF*/
characterfile.write("[EOF]", 0, 5);
characterfile.newLine();
characterfile.newLine();
characterfile.close();
} catch(IOException ioexception) {
misc.println(plr.playerName+": error writing file.");
return false;
}
return true;
}


public void println_debug(String str, int ID, String Name) {
System.out.println("[client-"+ID+"-"+Name+"]: "+str);
}
}
-----------------------------------------------------------------------------------

Edited 3 Years Ago by happygeek: fixed formatting

and learn to read compiler errors...
They tell you (usually) where and what the problem is.

First of all thank you for help, and second, ill tryed to follow compiler messages but when i "fixed" them next time there was even more errors so i get comfused...

As long as the compiler complains, you're doing something wrong.
If it no longer complains, you MAY be doing something right.

This article has been dead for over six months. Start a new discussion instead.