Browse Source

Fixed the writer for vminecraftusers

cerevisiae 14 years ago
parent
commit
ce46e2d011
2 changed files with 10 additions and 8 deletions
  1. 0 6
      vMinecraftListener.java
  2. 10 2
      vMinecraftUsers.java

+ 0 - 6
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;
-    }
-    **/
 
 }

+ 10 - 2
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() {