Alright.basically I made the file so it writes logs that the plugin gives the console,and saves it Except,it only gives me one line,and when I place the block multiple time,it still gives me one line Any tips? Here's the code Main class: http://pastebin.com/Z5QG9Etr Listener Class: http://pastebin.com/3rnuTu5D FileWriter: http://pastebin.com/EuVG9yTe Basically,this is the results: #NoNoGrief Log File #Mon Jul 16 05:53:53 CEST 2012 [NoNoGrief] krazyswaggaO has placed an illegal block in X:-100.47872339249258 Y:57.0 Z:83.5398635487277 I placed the block multiple times,only got one line. This is the server log just if you want it: http://pastebin.com/TMQNQNd9 I'm learning about files and all,so I think I missed a line or two.
Instead of: Code: PrintWriter outputStream = null; try { outputStream = new PrintWriter(new FileWriter(new File("plugins/NoNoGrief/NoNoGrief.txt"), true)); outputStream.println(warning); } finally { if (outputStream != null) { outputStream.close(); } } } Just make it simpler: Code: try{ PrintWriter write = new PrintWriter(yourfile, true); FileWriter text = new FileWriter(write); text.println(blahblah); text.close(); write.close(); }catch(IOException e){ e.printStackTrace(); }
no, its not good to not always close the stream, his example was correct, if there is an error at your example, then the file descriptor is not closed, doing this to manny times, your unable to connect to the server annymore
Just noticed something I have a clean file,I place only one block. http://gyazo.com/113ad91508a7e2a87e411b7577535781 I place many blocks,refresh my FTP and this happens http://gyazo.com/5b89f91b226d711892b24934759b099e So what I think is happening is,the blocks are registering but the code only allows things to process in one line,not multiple ones.How would I go at things now?