From ce46e2d0118bcc69bb5a12a4ddb28cf277614da8 Mon Sep 17 00:00:00 2001 From: cerevisiae Date: Wed, 1 Dec 2010 14:28:50 -0600 Subject: [PATCH] Fixed the writer for vminecraftusers --- vMinecraftListener.java | 6 ------ vMinecraftUsers.java | 12 ++++++++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/vMinecraftListener.java b/vMinecraftListener.java index ba3bfcc4e..6faeb1aaa 100644 --- a/vMinecraftListener.java +++ b/vMinecraftListener.java @@ -94,11 +94,5 @@ public class vMinecraftListener extends PluginListener { public void onLogin(Player player){ vMinecraftUsers.addUser(player); } - /** Not working yet, I posted the issue to hMod on github though - public boolean onDamage(DamageType type, BaseEntity attacker, BaseEntity defender, int amount) { - - return false; - } - **/ } \ No newline at end of file diff --git a/vMinecraftUsers.java b/vMinecraftUsers.java index 4d7b5675d..e4c69026c 100644 --- a/vMinecraftUsers.java +++ b/vMinecraftUsers.java @@ -43,10 +43,18 @@ public class vMinecraftUsers { String location = "vminecraftusers.txt"; try { writer = new FileWriter(location); - writer.write(player.getName()+"::::"); + writer.append(player.getName()+"::::"); } catch (Exception e) { log.log(Level.SEVERE, "Exception while trying to add user with writer to " + location, e); - } + } finally { + try { + if (writer != null) { + writer.close(); + } + } catch (IOException e) { + log.log(Level.SEVERE, "Exception while closing writer for " + location, e); + } + } } public static vMinecraftUsers getInstance() {