k so i added this feature where a person can save what their wearing and whats in their inventory so they can spawn it later.

loadgame method
[SPOIL]
Code:
public static int loadGame(Client p) {
String line = "";
String token = "";
String token2 = "";
String[] token3 = new String[3];
boolean EndOfFile = false;
int ReadMode = 0;
BufferedReader characterfile = null;
boolean File1 = false;
try {
characterfile = new BufferedReader(new FileReader("./Data/pksets/pkset1/"+p.playerName+".txt"));
File1 = true;
} catch(FileNotFoundException fileex1) {
}
if (File1) {
//new File ("./characters/"+playerName+".txt");
} else {
Misc.println(p.playerName+": character file not found.");
p.newPlayer = false;
return 0;
}
try {
line = characterfile.readLine();
} catch(IOException ioexception) {
Misc.println(p.playerName+": error loading file.");
return 3;
}
while(EndOfFile == false && line != null) {
line = line.trim();
int spot = line.indexOf("=");
if (spot > -1) {
token = line.substring(0, spot);
token = token.trim();
token2 = line.substring(spot + 1);
token2 = token2.trim();
token3 = token2.split("\t");
switch (ReadMode) {
case 1:
if (token.equals("pkset-item")) {
p.playerItems[Integer.parseInt(token3[0])] = Integer.parseInt(token3[1]);
p.playerItemsN[Integer.parseInt(token3[0])] = Integer.parseInt(token3[2]);
}
break;
case 2:
if (token.equals("pkset-equip")) {
p.playerEquipment[Integer.parseInt(token3[0])] = Integer.parseInt(token3[1]);
p.playerEquipmentN[Integer.parseInt(token3[0])] = Integer.parseInt(token3[2]);
}
break;
}
} else {
if (line.equals("[PKSET-ITEMS]")) { ReadMode = 1;
} else if (line.equals("[PK-SET-EQUIPT]")) { ReadMode = 2;
} else if (line.equals("[EOF]")) { try { characterfile.close(); } catch(IOException ioexception) { } return 1;
}
}
try {
line = characterfile.readLine();
} catch(IOException ioexception1) { EndOfFile = true; }
}
try { characterfile.close(); } catch(IOException ioexception) { }
return 13;
}
[/SPOIL]
heres the part i edited:
Code:
case 1:
if (token.equals("pkset-item")) {
for (int i : Config.PKP_ITEMS) {
if (i == Integer.parseInt(token3[1]) || i == Integer.parseInt(token3[1])-1) {
p.sendMessage("You can't save pkp items to your pk set.");
} else {
p.playerItems[Integer.parseInt(token3[0])] = Integer.parseInt(token3[1]);
p.playerItemsN[Integer.parseInt(token3[0])] = Integer.parseInt(token3[2]);
}
}
}
break;
my problem:
it says you can't have pkp items saved to ur pk set but it stills loads it...