Hello i'm trying to make a :uggestion command, wich basicly will store whatever they tyoe in the command into a txt document....
But i keep getting this error
Code:
src\server\model\players\packets\Commands.java:667: error: cannot find symbol BufferedWriter suggest = new BufferedWriter(new FileWriter("./Data/Suggestion s/Suggestions.txt", true)); ^ symbol: class BufferedWriter location: class Commands
src\server\model\players\packets\Commands.java:667: error: cannot find symbol BufferedWriter suggest = new BufferedWriter(new FileWriter("./Data/Suggestion s/Suggestions.txt", true)); ^ symbol: class BufferedWriter location: class Commands
src\server\model\players\packets\Commands.java:667: error: cannot find symbol BufferedWriter suggest = new BufferedWriter(new FileWriter("./Data/Suggestion s/Suggestions.txt", true)); ^ symbol: class FileWriter location: class Commands
src\server\model\players\packets\Commands.java:676: error: cannot find symbol } catch (IOException e) { ^ symbol: class IOException location: class Commands 4 errors Press any key to continue . . .
why does it say that?
The code ive used is
Code:
if (playerCommand.startsWith("suggestion")) {
try {
BufferedWriter suggest = new BufferedWriter(new FileWriter("./Data/Suggestions/Suggestions.txt", true));
String Suggestion = playerCommand.substring(8);
try {
suggest.newLine();
suggest.write(c.playerName + ": " + Suggestion);
c.sendMessage("Thank you for your suggestion, we will read over it soon.");
} finally {
suggest.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}