Eclipse says the scanner is never closed, and prompts me to suppress it, but it is closed.
public boolean hasPlayerAlreadyJoined(Player p) {
try {
Scanner scanner = new Scanner(joinedPlayers);
while (scanner.hasNextLine()) {
String name = scanner.nextLine();
if (name.equals(p.getName())) {
return true;
}
}
scanner.close();
} catch(Exception e){}
return false;
}
I am guessing it is because of the while loop but I have never ran into an error like this before. Am I doing something wrong?