diff options
author | drtshock <thensler@wisc.edu> | 2013-05-02 22:19:28 -0500 |
---|---|---|
committer | drtshock <thensler@wisc.edu> | 2013-05-02 22:19:28 -0500 |
commit | 3ff12f6bf52268b228aadbfbe634ca9ab0c135b6 (patch) | |
tree | 73ffe436673beeadd1768d36e137091a8f9fbffb | |
parent | f326d0ad0c22836fd0905b69303e9731ad268fe8 (diff) | |
download | Essentials-3ff12f6bf52268b228aadbfbe634ca9ab0c135b6.tar Essentials-3ff12f6bf52268b228aadbfbe634ca9ab0c135b6.tar.gz Essentials-3ff12f6bf52268b228aadbfbe634ca9ab0c135b6.tar.lz Essentials-3ff12f6bf52268b228aadbfbe634ca9ab0c135b6.tar.xz Essentials-3ff12f6bf52268b228aadbfbe634ca9ab0c135b6.zip |
More logging!
17 files changed, 48 insertions, 60 deletions
diff --git a/Essentials/src/net/ess3/storage/ManagedFile.java b/Essentials/src/net/ess3/storage/ManagedFile.java index 29e74102e..ef718fcf4 100644 --- a/Essentials/src/net/ess3/storage/ManagedFile.java +++ b/Essentials/src/net/ess3/storage/ManagedFile.java @@ -159,8 +159,7 @@ public class ManagedFile else { Bukkit.getLogger().warning( - "File " + file.toString() + " has been modified by user and file version " - + "differs, please update the file manually."); + "File " + file.toString() + " has been modified by user and file version differs, please update the file manually."); } } finally diff --git a/Essentials2Compat/src/com/earth2me/essentials/Essentials.java b/Essentials2Compat/src/com/earth2me/essentials/Essentials.java index c22730f3d..ee9ce0f6b 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/Essentials.java +++ b/Essentials2Compat/src/com/earth2me/essentials/Essentials.java @@ -15,12 +15,12 @@ public class Essentials extends JavaPlugin @Override public void onEnable() { - Bukkit.getLogger().info("You can remove this compatibility plugin, when all plugins are updated to Essentials-3"); + IPlugin plugin = (IPlugin)getServer().getPluginManager().getPlugin("Essentials-3"); + ess = plugin.getEssentials(); + ess.getLogger().info("You can remove this compatibility plugin, when all plugins are updated to Essentials-3"); //TODO: Update files to new 3.0 format //TODO: Move Eco Api here //TODO: write update methods for itemmeta - IPlugin plugin = (IPlugin)getServer().getPluginManager().getPlugin("Essentials-3"); - ess = plugin.getEssentials(); updateSettings(); updateUserfiles(); } diff --git a/Essentials2Compat/src/com/earth2me/essentials/Settings.java b/Essentials2Compat/src/com/earth2me/essentials/Settings.java index 40ed1918c..95006b831 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/Settings.java +++ b/Essentials2Compat/src/com/earth2me/essentials/Settings.java @@ -17,7 +17,6 @@ import org.bukkit.inventory.ItemStack; public final class Settings implements ISettings { private final EssentialsConf config; - private final static Logger logger = Logger.getLogger("Minecraft"); private final IEssentials ess; private boolean metricsEnabled = true; @@ -418,7 +417,7 @@ public final class Settings implements ISettings final List<Integer> epItemSpwn = new ArrayList<Integer>(); if (ess.getItemDb() == null) { - logger.log(Level.FINE, "Aborting ItemSpawnBL read, itemDB not yet loaded."); + ess.getLogger().log(Level.FINE, "Aborting ItemSpawnBL read, itemDB not yet loaded."); return epItemSpwn; } for (String itemName : config.getString("item-spawn-blacklist", "").split(",")) @@ -435,7 +434,7 @@ public final class Settings implements ISettings } catch (Exception ex) { - logger.log(Level.SEVERE, _("§4Unknown item {0} in {1} list.", itemName, "item-spawn-blacklist")); + ess.getLogger().log(Level.SEVERE, _("§4Unknown item {0} in {1} list.", itemName, "item-spawn-blacklist")); } } return epItemSpwn; @@ -471,7 +470,7 @@ public final class Settings implements ISettings } catch (Exception ex) { - logger.log(Level.SEVERE, _("§4Unknown item {0} in {1} list.", signName, "enabledSigns")); + ess.getLogger().log(Level.SEVERE, _("§4Unknown item {0} in {1} list.", signName, "enabledSigns")); continue; } signsEnabled = true; @@ -565,7 +564,7 @@ public final class Settings implements ISettings } catch (Exception ex) { - logger.log(Level.SEVERE, _("§4Unknown item {0} in {1} list.", itemName, configName)); + ess.getLogger().log(Level.SEVERE, _("§4Unknown item {0} in {1} list.", itemName, configName)); } } return list; diff --git a/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsConnect.java b/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsConnect.java index b76152916..8a1206b29 100644 --- a/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsConnect.java +++ b/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsConnect.java @@ -12,7 +12,6 @@ import org.bukkit.plugin.Plugin; public class EssentialsConnect { - private static final Logger LOGGER = Logger.getLogger("Minecraft"); private final IEssentials ess; private final IAntiBuild antib; @@ -20,7 +19,7 @@ public class EssentialsConnect { if (!essProtect.getDescription().getVersion().equals(essPlugin.getDescription().getVersion())) { - LOGGER.log(Level.WARNING, _("§4Version mismatch! Please update all Essentials jars to the same version.")); + essPlugin.getLogger().log(Level.WARNING, _("§4Version mismatch! Please update all Essentials jars to the same version.")); } ess = ((BukkitPlugin)essPlugin).getEssentials(); antib = (IAntiBuild)essProtect; @@ -43,7 +42,7 @@ public class EssentialsConnect final Location loc = user.getLocation(); final String warnMessage = _( "alertFormat", user.getName(), type, item, loc.getWorld().getName() + "," + loc.getBlockX() + "," + loc.getBlockY() + "," + loc.getBlockZ()); - LOGGER.log(Level.WARNING, warnMessage); + ess.getLogger().log(Level.WARNING, warnMessage); for (Player p : ess.getServer().getOnlinePlayers()) { if (Permissions.ALERTS.isAuthorized(p)) diff --git a/EssentialsChat/src/net/ess3/chat/EssentialsChat.java b/EssentialsChat/src/net/ess3/chat/EssentialsChat.java index c80694d22..cbe0416c9 100644 --- a/EssentialsChat/src/net/ess3/chat/EssentialsChat.java +++ b/EssentialsChat/src/net/ess3/chat/EssentialsChat.java @@ -18,7 +18,6 @@ import org.bukkit.plugin.java.JavaPlugin; public class EssentialsChat extends JavaPlugin { - private static final Logger LOGGER = Logger.getLogger("Minecraft"); @Override public void onEnable() @@ -28,7 +27,7 @@ public class EssentialsChat extends JavaPlugin final IEssentials ess = (IEssentials)plugin.getEssentials(); if (!this.getDescription().getVersion().equals(plugin.getDescription().getVersion())) { - LOGGER.log(Level.WARNING, _("§4Version mismatch! Please update all Essentials jars to the same version.")); + getLogger().log(Level.WARNING, _("§4Version mismatch! Please update all Essentials jars to the same version.")); } if (!plugin.isEnabled()) { diff --git a/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java b/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java index 15e2d3b8b..fb498f5e9 100644 --- a/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java +++ b/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java @@ -18,7 +18,6 @@ import org.bukkit.event.player.AsyncPlayerChatEvent; public abstract class EssentialsChatPlayer implements Listener { protected IEssentials ess; - protected final static Logger LOGGER = Logger.getLogger("Minecraft"); protected final Server server; protected final Map<AsyncPlayerChatEvent, ChatStore> chatStorage; diff --git a/EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIPPlayerListener.java b/EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIPPlayerListener.java index 4936ad0ab..bfdb41292 100644 --- a/EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIPPlayerListener.java +++ b/EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIPPlayerListener.java @@ -27,7 +27,6 @@ import org.bukkit.plugin.Plugin; public class EssentialsGeoIPPlayerListener implements Listener, IReload { private LookupService ls = null; - private static final Logger LOGGER = Logger.getLogger("Minecraft"); private File databaseFile; private final ConfigHolder config; private final IEssentials ess; @@ -127,7 +126,7 @@ public class EssentialsGeoIPPlayerListener implements Listener, IReload } else { - LOGGER.log(Level.SEVERE, _("Can't find GeoIP database!")); + ess.getLogger().log(Level.SEVERE, _("Can't find GeoIP database!")); return; } } @@ -137,7 +136,7 @@ public class EssentialsGeoIPPlayerListener implements Listener, IReload } catch (IOException ex) { - LOGGER.log(Level.SEVERE, _("Failed to read GeoIP database!"), ex); + ess.getLogger().log(Level.SEVERE, _("Failed to read GeoIP database!"), ex); } } @@ -145,7 +144,7 @@ public class EssentialsGeoIPPlayerListener implements Listener, IReload { if (url == null || url.isEmpty()) { - LOGGER.log(Level.SEVERE, _("GeoIP download url is empty.")); + ess.getLogger().log(Level.SEVERE, _("GeoIP download url is empty.")); return; } if (!databaseFile.getAbsoluteFile().getParentFile().exists()) @@ -156,7 +155,7 @@ public class EssentialsGeoIPPlayerListener implements Listener, IReload OutputStream output = null; try { - LOGGER.log(Level.INFO, _("Downloading GeoIP database... this might take a while (country: 0.6 MB, city: 20MB)")); + ess.getLogger().log(Level.INFO, _("Downloading GeoIP database... this might take a while (country: 0.6 MB, city: 20MB)")); final URL downloadUrl = new URL(url); final URLConnection conn = downloadUrl.openConnection(); conn.setConnectTimeout(10000); @@ -179,11 +178,11 @@ public class EssentialsGeoIPPlayerListener implements Listener, IReload } catch (MalformedURLException ex) { - LOGGER.log(Level.SEVERE, _("GeoIP download url is invalid."), ex); + ess.getLogger().log(Level.SEVERE, _("GeoIP download url is invalid."), ex); } catch (IOException ex) { - LOGGER.log(Level.SEVERE, _("Failed to open connection."), ex); + ess.getLogger().log(Level.SEVERE, _("Failed to open connection."), ex); } finally { @@ -195,7 +194,7 @@ public class EssentialsGeoIPPlayerListener implements Listener, IReload } catch (IOException ex) { - LOGGER.log(Level.SEVERE, _("Failed to open connection."), ex); + ess.getLogger().log(Level.SEVERE, _("Failed to open connection."), ex); } } if (input != null) @@ -206,7 +205,7 @@ public class EssentialsGeoIPPlayerListener implements Listener, IReload } catch (IOException ex) { - LOGGER.log(Level.SEVERE, _("Failed to open connection."), ex); + ess.getLogger().log(Level.SEVERE, _("Failed to open connection."), ex); } } } diff --git a/EssentialsProtect/src/net/ess3/protect/EssentialsConnect.java b/EssentialsProtect/src/net/ess3/protect/EssentialsConnect.java index 8002a469e..6d1a1c333 100644 --- a/EssentialsProtect/src/net/ess3/protect/EssentialsConnect.java +++ b/EssentialsProtect/src/net/ess3/protect/EssentialsConnect.java @@ -10,7 +10,6 @@ import org.bukkit.plugin.Plugin; public class EssentialsConnect { - private static final Logger LOGGER = Logger.getLogger("Minecraft"); private final IEssentials ess; private final IProtect protect; @@ -18,7 +17,7 @@ public class EssentialsConnect { if (!essProtect.getDescription().getVersion().equals(essPlugin.getDescription().getVersion())) { - LOGGER.log(Level.WARNING, _("§4Version mismatch! Please update all Essentials jars to the same version.")); + essPlugin.getLogger().log(Level.WARNING, _("§4Version mismatch! Please update all Essentials jars to the same version.")); } ess = ((BukkitPlugin)essPlugin).getEssentials(); protect = (IProtect)essProtect; diff --git a/EssentialsProtect/src/net/ess3/protect/EssentialsProtect.java b/EssentialsProtect/src/net/ess3/protect/EssentialsProtect.java index 2bb765b50..8b9fc7656 100644 --- a/EssentialsProtect/src/net/ess3/protect/EssentialsProtect.java +++ b/EssentialsProtect/src/net/ess3/protect/EssentialsProtect.java @@ -10,7 +10,6 @@ import org.bukkit.plugin.java.JavaPlugin; public class EssentialsProtect extends JavaPlugin implements IProtect { - private static final Logger LOGGER = Logger.getLogger("Minecraft"); private EssentialsConnect ess = null; private ProtectHolder settings = null; @@ -45,7 +44,7 @@ public class EssentialsProtect extends JavaPlugin implements IProtect { player.sendMessage("Essentials Protect is in emergency mode. Check your log for errors."); //TODO: tl this } - LOGGER.log(Level.SEVERE, "Essentials not installed or failed to load. Essentials Protect is in emergency mode now."); //TODO: tl this + getLogger().log(Level.SEVERE, "Essentials not installed or failed to load. Essentials Protect is in emergency mode now."); //TODO: tl this } @Override diff --git a/EssentialsSigns/src/net/ess3/signs/EssentialsSignsPlugin.java b/EssentialsSigns/src/net/ess3/signs/EssentialsSignsPlugin.java index 1143aa022..7d5e80cf9 100644 --- a/EssentialsSigns/src/net/ess3/signs/EssentialsSignsPlugin.java +++ b/EssentialsSigns/src/net/ess3/signs/EssentialsSignsPlugin.java @@ -15,7 +15,6 @@ import org.bukkit.plugin.java.JavaPlugin; public class EssentialsSignsPlugin extends JavaPlugin implements ISignsPlugin { - private static final Logger LOGGER = Bukkit.getLogger(); private SignsConfigHolder config; @Override @@ -26,7 +25,7 @@ public class EssentialsSignsPlugin extends JavaPlugin implements ISignsPlugin final IEssentials ess = (IEssentials)plugin.getEssentials(); if (!this.getDescription().getVersion().equals(plugin.getDescription().getVersion())) { - LOGGER.log(Level.WARNING, _("§4Version mismatch! Please update all Essentials jars to the same version.")); + getLogger().log(Level.WARNING, _("§4Version mismatch! Please update all Essentials jars to the same version.")); } if (!plugin.isEnabled()) { diff --git a/EssentialsSigns/src/net/ess3/signs/listeners/SignBlockListener.java b/EssentialsSigns/src/net/ess3/signs/listeners/SignBlockListener.java index 69ca1b4c2..9c0b853cc 100644 --- a/EssentialsSigns/src/net/ess3/signs/listeners/SignBlockListener.java +++ b/EssentialsSigns/src/net/ess3/signs/listeners/SignBlockListener.java @@ -23,7 +23,6 @@ public class SignBlockListener implements Listener { private final IEssentials ess; private final ISignsPlugin plugin; - private final static Logger LOGGER = Logger.getLogger("Minecraft"); private final static int WALL_SIGN = Material.WALL_SIGN.getId(); private final static int SIGN_POST = Material.SIGN_POST.getId(); @@ -52,7 +51,7 @@ public class SignBlockListener implements Listener // prevent any signs be broken by destroying the block they are attached to if (EssentialsSign.checkIfBlockBreaksSigns(block)) { - LOGGER.log(Level.INFO, "Prevented that a block was broken next to a sign."); + ess.getLogger().log(Level.INFO, "Prevented that a block was broken next to a sign."); return true; } @@ -73,7 +72,7 @@ public class SignBlockListener implements Listener { if (sign.getBlocks().contains(block.getType()) && !sign.onBlockBreak(block, player, ess)) { - LOGGER.log(Level.INFO, "A block was protected by a sign."); + ess.getLogger().log(Level.INFO, "A block was protected by a sign."); return true; } } diff --git a/EssentialsUpdate/src/net/ess3/update/EssentialsUpdate.java b/EssentialsUpdate/src/net/ess3/update/EssentialsUpdate.java index 13aec2c00..be9cb16c2 100644 --- a/EssentialsUpdate/src/net/ess3/update/EssentialsUpdate.java +++ b/EssentialsUpdate/src/net/ess3/update/EssentialsUpdate.java @@ -17,7 +17,7 @@ public class EssentialsUpdate extends JavaPlugin { if (!getDataFolder().exists() && !getDataFolder().mkdirs()) { - Bukkit.getLogger().log(Level.SEVERE, "Could not create data folder: {0}", getDataFolder().getPath()); + getLogger().log(Level.SEVERE, "Could not create data folder: {0}", getDataFolder().getPath()); } essentialsHelp = new EssentialsHelp(this); essentialsHelp.registerEvents(); @@ -33,7 +33,7 @@ public class EssentialsUpdate extends JavaPlugin } else { - Bukkit.getLogger().info("Essentials is ready for installation. Join the game and follow the instructions."); + getLogger().info("Essentials is ready for installation. Join the game and follow the instructions."); } } diff --git a/EssentialsUpdate/src/net/ess3/update/UpdateCheck.java b/EssentialsUpdate/src/net/ess3/update/UpdateCheck.java index bd3e6300e..0a3f3edab 100644 --- a/EssentialsUpdate/src/net/ess3/update/UpdateCheck.java +++ b/EssentialsUpdate/src/net/ess3/update/UpdateCheck.java @@ -42,7 +42,7 @@ public class UpdateCheck { if (new File(plugin.getDataFolder().getParentFile(), "Essentials.jar").exists()) { - Bukkit.getLogger().severe("Essentials.jar found, but not recognized by Bukkit. Broken download?"); + plugin.getLogger().severe("Essentials.jar found, but not recognized by Bukkit. Broken download?"); } } } diff --git a/EssentialsUpdate/src/net/ess3/update/UpdateFile.java b/EssentialsUpdate/src/net/ess3/update/UpdateFile.java index 117daab8c..ec9017461 100644 --- a/EssentialsUpdate/src/net/ess3/update/UpdateFile.java +++ b/EssentialsUpdate/src/net/ess3/update/UpdateFile.java @@ -19,7 +19,6 @@ import org.bukkit.plugin.Plugin; public class UpdateFile { - private final static Logger LOGGER = Bukkit.getLogger(); private final static String UPDATE_URL = "http://goo.gl/67jev"; private final static BigInteger PUBLIC_KEY = new BigInteger( "5ha6a2d4qdy17ttkg8evh74sl5a87djojwenu12k1lvy8ui6003e6l06rntczpoh99mhc3txj8mqlxw111oyy9yl7s7qpyluyzix3j1odxrxx4u52gxvyu6qiteapczkzvi7rxgeqsozz7b19rdx73a7quo9ybwpz1cr82r7x5k0pg2a73pjjsv2j1awr13azo7klrcxp9y5xxwf5qv1s3tw4zqftli18u0ek5qkbzfbgk1v5n2f11pkwwk6p0mibrn26wnjbv11vyiqgu95o7busmt6vf5q7grpcenl637w83mbin56s3asj1131b2mscj9xep3cbj7la9tgsxl5bj87vzy8sk2d34kzwqdqgh9nry43nqqus12l1stmiv184r8r3jcy8w43e8h1u1mzklldb5eytkuhayqik8l3ns04hwt8sgacvw534be8sx26qrn5s1", @@ -37,12 +36,12 @@ public class UpdateFile { if (file.exists() && !file.delete()) { - LOGGER.log(Level.SEVERE, "Could not delete file update.yml!"); + plugin.getLogger().log(Level.SEVERE, "Could not delete file update.yml!"); return; } if (!downloadFile() || !checkFile()) { - LOGGER.log(Level.SEVERE, "Could not download and verify file update.yml!"); + plugin.getLogger().log(Level.SEVERE, "Could not download and verify file update.yml!"); return; } } @@ -52,7 +51,7 @@ public class UpdateFile } catch (Exception ex) { - LOGGER.log(Level.SEVERE, "Could not load update.yml!"); + plugin.getLogger().log(Level.SEVERE, "Could not load update.yml!"); } } @@ -69,7 +68,7 @@ public class UpdateFile } catch (IOException ex) { - LOGGER.log(Level.SEVERE, "Error while downloading update.yml", ex); + plugin.getLogger().log(Level.SEVERE, "Error while downloading update.yml", ex); return false; } } @@ -163,7 +162,7 @@ public class UpdateFile } catch (Exception ex) { - LOGGER.log(Level.SEVERE, ex.getMessage(), ex); + plugin.getLogger().log(Level.SEVERE, ex.getMessage(), ex); } finally { @@ -176,7 +175,7 @@ public class UpdateFile } catch (IOException ex) { - LOGGER.log(Level.SEVERE, ex.getMessage(), ex); + plugin.getLogger().log(Level.SEVERE, ex.getMessage(), ex); } } return false; diff --git a/EssentialsUpdate/src/net/ess3/update/UpdateProcess.java b/EssentialsUpdate/src/net/ess3/update/UpdateProcess.java index 9d09264e3..b13c9f382 100644 --- a/EssentialsUpdate/src/net/ess3/update/UpdateProcess.java +++ b/EssentialsUpdate/src/net/ess3/update/UpdateProcess.java @@ -43,7 +43,7 @@ public class UpdateProcess implements Listener { currentPlayer.sendMessage("A newer version of EssentialsUpdate is found. Downloading new file and reloading server."); } - Bukkit.getLogger().log(Level.INFO, "A newer version of EssentialsUpdate is found. Downloading new file and reloading server."); + plugin.getLogger().log(Level.INFO, "A newer version of EssentialsUpdate is found. Downloading new file and reloading server."); new SelfUpdate( new AbstractWorkListener(plugin, updateCheck.getNewVersionInfo()) { @@ -70,7 +70,7 @@ public class UpdateProcess implements Listener } if (message != null && !message.isEmpty()) { - Bukkit.getLogger().log(Level.INFO, message); + plugin.getLogger().log(Level.INFO, message); } UpdateProcess.this.currentPlayer = null; } diff --git a/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java index e89d142da..75ee46542 100644 --- a/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java @@ -18,7 +18,6 @@ import org.bukkit.plugin.java.JavaPlugin; public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP { - private static final Logger LOGGER = Logger.getLogger("Minecraft"); private static EssentialsXMPP instance = null; private UserManager users; private XMPPManager xmpp; @@ -40,7 +39,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP ess = plugin.getEssentials(); if (!this.getDescription().getVersion().equals(plugin.getDescription().getVersion())) { - LOGGER.log(Level.WARNING, _("§4Version mismatch! Please update all Essentials jars to the same version.")); + getLogger().log(Level.WARNING, _("§4Version mismatch! Please update all Essentials jars to the same version.")); } if (!plugin.isEnabled()) { diff --git a/EssentialsXMPP/src/net/ess3/xmpp/XMPPManager.java b/EssentialsXMPP/src/net/ess3/xmpp/XMPPManager.java index 34d98cb11..8097a992f 100644 --- a/EssentialsXMPP/src/net/ess3/xmpp/XMPPManager.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/XMPPManager.java @@ -3,6 +3,7 @@ package net.ess3.xmpp; import java.io.File; import java.util.*; import java.util.logging.*; +import net.ess3.api.IEssentials; import net.ess3.api.IReload; import net.ess3.api.IUser; import net.ess3.utils.FormatUtil; @@ -17,7 +18,6 @@ import org.jivesoftware.smack.util.StringUtils; public final class XMPPManager extends Handler implements MessageListener, ChatManagerListener, IReload { - private static final Logger LOGGER = Logger.getLogger("Minecraft"); private static final SimpleFormatter formatter = new SimpleFormatter(); private YamlConfiguration config = null; private XMPPConnection connection; @@ -98,7 +98,7 @@ public final class XMPPManager extends Handler implements MessageListener, ChatM final String server = config.getString("xmpp.server"); if (server == null || server.equals("example.com")) { - LOGGER.log(Level.WARNING, "config broken for xmpp"); + parent.getLogger().log(Level.WARNING, "config broken for xmpp"); return false; } final int port = config.getInt("xmpp.port", 5222); @@ -109,7 +109,7 @@ public final class XMPPManager extends Handler implements MessageListener, ChatM final StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("Connecting to xmpp server ").append(server).append(":").append(port); stringBuilder.append(" as user ").append(xmppuser).append("."); - LOGGER.log(Level.INFO, stringBuilder.toString()); + parent.getLogger().log(Level.INFO, stringBuilder.toString()); connConf.setSASLAuthenticationEnabled(config.getBoolean("xmpp.sasl-enabled", false)); connConf.setSendPresence(true); connConf.setReconnectionAllowed(true); @@ -125,7 +125,7 @@ public final class XMPPManager extends Handler implements MessageListener, ChatM } catch (XMPPException ex) { - LOGGER.log(Level.WARNING, "Failed to connect to server: " + server, ex); + parent.getLogger().log(Level.WARNING, "Failed to connect to server: " + server, ex); return false; } } @@ -165,7 +165,7 @@ public final class XMPPManager extends Handler implements MessageListener, ChatM @Override public void onReload() { - LOGGER.removeHandler(this); + parent.getLogger().removeHandler(this); config = YamlConfiguration.loadConfiguration(new File(parent.getDataFolder(), "config.yml")); synchronized (chats) { @@ -179,7 +179,7 @@ public final class XMPPManager extends Handler implements MessageListener, ChatM } if (config.getBoolean("log-enabled", false)) { - LOGGER.addHandler(this); + parent.getLogger().addHandler(this); logUsers = config.getStringList("log-users"); final String level = config.getString("log-level", "info"); try @@ -271,14 +271,14 @@ public final class XMPPManager extends Handler implements MessageListener, ChatM catch (XMPPException ex) { failedUsers.add(user); - LOGGER.removeHandler(XMPPManager.this); - LOGGER.log(Level.SEVERE, "Failed to deliver log message! Disabling logging to XMPP.", ex); + parent.getLogger().removeHandler(XMPPManager.this); + parent.getLogger().log(Level.SEVERE, "Failed to deliver log message! Disabling logging to XMPP.", ex); } } logUsers.removeAll(failedUsers); if (logUsers.isEmpty()) { - LOGGER.removeHandler(XMPPManager.this); + parent.getLogger().removeHandler(XMPPManager.this); threadrunning = false; } copy.clear(); @@ -292,7 +292,7 @@ public final class XMPPManager extends Handler implements MessageListener, ChatM threadrunning = false; } } - LOGGER.removeHandler(XMPPManager.this); + parent.getLogger().removeHandler(XMPPManager.this); } }); loggerThread.start(); @@ -333,7 +333,7 @@ public final class XMPPManager extends Handler implements MessageListener, ChatM } catch (XMPPException ex) { - LOGGER.log(Level.WARNING, "Failed to send xmpp message.", ex); + parent.getLogger().log(Level.WARNING, "Failed to send xmpp message.", ex); } } else @@ -357,7 +357,7 @@ public final class XMPPManager extends Handler implements MessageListener, ChatM } catch (Exception ex) { - LOGGER.log(Level.SEVERE, ex.getMessage(), ex); + parent.getLogger().log(Level.SEVERE, ex.getMessage(), ex); } } } |