From 02336057858ecd3d89437d08cdab51a164382746 Mon Sep 17 00:00:00 2001 From: cerevisiae Date: Tue, 7 Dec 2010 22:53:51 -0600 Subject: [PATCH] Adding players to the PlayerList should work now. --- vMinecraftListener.java | 1 + vMinecraftUsers.java | 24 +++--------------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/vMinecraftListener.java b/vMinecraftListener.java index 70459c811..4643b04c5 100644 --- a/vMinecraftListener.java +++ b/vMinecraftListener.java @@ -90,6 +90,7 @@ public class vMinecraftListener extends PluginListener { public void onLogin(Player player){ vMinecraftUsers.addUser(player); } + public boolean onIgnite(Block block, Player player) { if(vMinecraftSettings.stopFire){ if (vMinecraftSettings.fireNoSpread.contains(block)){ diff --git a/vMinecraftUsers.java b/vMinecraftUsers.java index 9b12ab477..7c074acfa 100644 --- a/vMinecraftUsers.java +++ b/vMinecraftUsers.java @@ -64,29 +64,11 @@ public class vMinecraftUsers { } return false; } + public static void addUser(Player player){ - FileWriter writer = null; - String location = "vminecraftusers.txt"; - String playerName = player.getName(); - if (!vMinecraftUsers.getInstance().doesPlayerExist(playerName)){ //Check to see if the player exists before writing - try { - BufferedWriter bw = new BufferedWriter(new FileWriter(location, true)); - bw.append(player.getName()+":::::\r"); - bw.newLine(); - bw.close(); - } catch (Exception e) { - log.log(Level.SEVERE, "Exception while trying to add user with BufferedWriter to " + location, e); - } finally { - try { - if (writer != null) { - writer.close(); - } - } catch (IOException e) { - log.log(Level.SEVERE, "Exception while closing BufferedWriter to " + location, e); - } - } - } + players.addPlayer(player); } + public static vMinecraftUsers getInstance() { if (instance == null) { instance = new vMinecraftUsers();