|
|
@ -44,26 +44,26 @@ public class PlayerManager { |
|
|
|
StringBuilder pointBuilder = new StringBuilder(); |
|
|
|
StringBuilder[] sb = {nameBuilder, pointBuilder}; |
|
|
|
|
|
|
|
for (int i = 0; i < PLAYER_ATTRIBUTES; i++) { |
|
|
|
do { |
|
|
|
c = fr.read(); |
|
|
|
if (c == ';' || c == '\n' || c == -1) { |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
sb[i].append((char) c); |
|
|
|
} while (c != ';' && c != '\n' && c != -1); |
|
|
|
} |
|
|
|
|
|
|
|
if (!(nameBuilder.toString().equals("") || pointBuilder.toString().equals(""))) { |
|
|
|
playerName = nameBuilder.toString(); |
|
|
|
playerPoints = Integer.parseInt(pointBuilder.toString()); |
|
|
|
do { |
|
|
|
for (int i = 0; i < PLAYER_ATTRIBUTES; i++) { |
|
|
|
do { |
|
|
|
c = fr.read(); |
|
|
|
if (c != ';' && c != '\n' && c != -1) { |
|
|
|
sb[i].append((char) c); |
|
|
|
} |
|
|
|
} while (c != ';' && c != '\n' && c != -1); |
|
|
|
} |
|
|
|
|
|
|
|
players.add(new Player(playerName, playerPoints)); |
|
|
|
|
|
|
|
nameBuilder.delete(0, nameBuilder.length()); |
|
|
|
pointBuilder.delete(0, pointBuilder.length()); |
|
|
|
} |
|
|
|
if (!nameBuilder.toString().equals("") && !pointBuilder.toString().equals("")) { |
|
|
|
playerName = nameBuilder.toString(); |
|
|
|
playerPoints = Integer.parseInt(pointBuilder.toString()); |
|
|
|
|
|
|
|
players.add(new Player(playerName, playerPoints)); |
|
|
|
|
|
|
|
nameBuilder.delete(0, nameBuilder.length()); |
|
|
|
pointBuilder.delete(0, pointBuilder.length()); |
|
|
|
} |
|
|
|
} while (c != -1); |
|
|
|
|
|
|
|
fr.close(); |
|
|
|
} catch (IOException e) { |
|
|
|