summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIaccidentally <coryhuckaby@gmail.com>2013-05-02 13:04:20 -0700
committerIaccidentally <coryhuckaby@gmail.com>2013-05-02 13:04:20 -0700
commitc16b09a9eaf6cf1f8c4b9e37f33f4e4295de9113 (patch)
treef4569feb98c3343d540c3f5468ab6d8a5220a0e6
parent6807f878ad0e2bbc5b651553520ea9c58ec83d14 (diff)
parentf326d0ad0c22836fd0905b69303e9731ad268fe8 (diff)
downloadEssentials-c16b09a9eaf6cf1f8c4b9e37f33f4e4295de9113.tar
Essentials-c16b09a9eaf6cf1f8c4b9e37f33f4e4295de9113.tar.gz
Essentials-c16b09a9eaf6cf1f8c4b9e37f33f4e4295de9113.tar.lz
Essentials-c16b09a9eaf6cf1f8c4b9e37f33f4e4295de9113.tar.xz
Essentials-c16b09a9eaf6cf1f8c4b9e37f33f4e4295de9113.zip
Merge pull request #469 from drtshock/master
[Fixed] Use proper logging
-rw-r--r--Essentials/src/net/ess3/I18n.java2
-rw-r--r--Essentials/src/net/ess3/Jails.java13
-rw-r--r--Essentials/src/net/ess3/commands/EssentialsCommandHandler.java17
-rw-r--r--Essentials/src/net/ess3/listener/EssentialsPlayerListener.java7
-rw-r--r--Essentials/src/net/ess3/storage/AbstractDelayedYamlFileReader.java6
-rw-r--r--Essentials/src/net/ess3/storage/AbstractDelayedYamlFileWriter.java2
-rw-r--r--Essentials/src/net/ess3/storage/AsyncStorageObjectHolder.java4
-rw-r--r--Essentials/src/net/ess3/storage/ManagedFile.java11
-rw-r--r--Essentials/src/net/ess3/utils/textreader/HelpInput.java5
9 files changed, 34 insertions, 33 deletions
diff --git a/Essentials/src/net/ess3/I18n.java b/Essentials/src/net/ess3/I18n.java
index 9cc7b10dd..6ea824e89 100644
--- a/Essentials/src/net/ess3/I18n.java
+++ b/Essentials/src/net/ess3/I18n.java
@@ -126,7 +126,7 @@ public class I18n implements II18n
currentLocale = new Locale(parts[0], parts[1], parts[2]);
}
ResourceBundle.clearCache();
- Logger.getLogger("Minecraft").log(Level.INFO, String.format("Using locale %s", currentLocale.toString()));
+ ess.getLogger().log(Level.INFO, String.format("Using locale %s", currentLocale.toString()));
customBundle = ResourceBundle.getBundle(MESSAGES, currentLocale, new FileResClassLoader(I18n.class.getClassLoader(), ess));
localeBundle = ResourceBundle.getBundle(MESSAGES, currentLocale);
}
diff --git a/Essentials/src/net/ess3/Jails.java b/Essentials/src/net/ess3/Jails.java
index d3f1679cf..50c99cb51 100644
--- a/Essentials/src/net/ess3/Jails.java
+++ b/Essentials/src/net/ess3/Jails.java
@@ -30,7 +30,6 @@ import org.bukkit.plugin.PluginManager;
public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> implements IJails
{
- private static final Logger LOGGER = Bukkit.getLogger();
public Jails(final IEssentials ess)
{
@@ -174,11 +173,11 @@ public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> imp
{
if (ess.getSettings().isDebug())
{
- LOGGER.log(Level.INFO, _("§4Error occurred when trying to return player§c {0} §4to jail: {1}!", user.getName(), ex.getLocalizedMessage()), ex);
+ ess.getLogger().log(Level.INFO, _("§4Error occurred when trying to return player§c {0} §4to jail: {1}!", user.getName(), ex.getLocalizedMessage()), ex);
}
else
{
- LOGGER.log(Level.INFO, _("§4Error occurred when trying to return player§c {0} §4to jail: {1}!", user.getName(), ex.getLocalizedMessage()));
+ ess.getLogger().log(Level.INFO, _("§4Error occurred when trying to return player§c {0} §4to jail: {1}!", user.getName(), ex.getLocalizedMessage()));
}
}
}
@@ -200,11 +199,11 @@ public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> imp
{
if (ess.getSettings().isDebug())
{
- LOGGER.log(Level.INFO, _("§4Error occurred when trying to return player§c {0} §4to jail: {1}!", user.getName(), ex.getLocalizedMessage()), ex);
+ ess.getLogger().log(Level.INFO, _("§4Error occurred when trying to return player§c {0} §4to jail: {1}!", user.getName(), ex.getLocalizedMessage()), ex);
}
else
{
- LOGGER.log(Level.INFO, _("§4Error occurred when trying to return player§c {0} §4to jail: {1}!", user.getName(), ex.getLocalizedMessage()));
+ ess.getLogger().log(Level.INFO, _("§4Error occurred when trying to return player§c {0} §4to jail: {1}!", user.getName(), ex.getLocalizedMessage()));
}
}
user.sendMessage(_("§4You do the crime, you do the time."));
@@ -227,11 +226,11 @@ public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> imp
{
if (ess.getSettings().isDebug())
{
- LOGGER.log(Level.INFO, _("§4Error occurred when trying to return player§c {0} §4to jail: {1}!", user.getName(), ex.getLocalizedMessage()), ex);
+ ess.getLogger().log(Level.INFO, _("§4Error occurred when trying to return player§c {0} §4to jail: {1}!", user.getName(), ex.getLocalizedMessage()), ex);
}
else
{
- LOGGER.log(Level.INFO, _("§4Error occurred when trying to return player§c {0} §4to jail: {1}!", user.getName(), ex.getLocalizedMessage()));
+ ess.getLogger().log(Level.INFO, _("§4Error occurred when trying to return player§c {0} §4to jail: {1}!", user.getName(), ex.getLocalizedMessage()));
}
}
user.sendMessage(_("§4You do the crime, you do the time."));
diff --git a/Essentials/src/net/ess3/commands/EssentialsCommandHandler.java b/Essentials/src/net/ess3/commands/EssentialsCommandHandler.java
index f56ef2168..5e0b461d5 100644
--- a/Essentials/src/net/ess3/commands/EssentialsCommandHandler.java
+++ b/Essentials/src/net/ess3/commands/EssentialsCommandHandler.java
@@ -17,7 +17,6 @@ public class EssentialsCommandHandler implements ICommandHandler, TabExecutor
private final ClassLoader classLoader;
private final String commandPath;
private final String permissionPrefix;// TODO: Needed?
- private static final Logger LOGGER = Bukkit.getLogger();
private final Map<String, List<PluginCommand>> altcommands = new HashMap<String, List<PluginCommand>>();
private final Map<String, String> disabledList = new HashMap<String, String>();
private final Map<String, IEssentialsCommand> commands = new HashMap<String, IEssentialsCommand>();
@@ -106,7 +105,7 @@ public class EssentialsCommandHandler implements ICommandHandler, TabExecutor
catch (Exception ex)
{
sender.sendMessage(_("§4Command {0} is improperly loaded.", commandName));
- LOGGER.log(Level.SEVERE, _("§4Command {0} is improperly loaded.", commandName), ex);
+ ess.getLogger().log(Level.SEVERE, _("§4Command {0} is improperly loaded.", commandName), ex);
return true;
}
}
@@ -114,7 +113,7 @@ public class EssentialsCommandHandler implements ICommandHandler, TabExecutor
// Check authorization
if (sender != null && !cmd.isAuthorized(sender))
{
- LOGGER.log(Level.WARNING, _("§c{0} §4was denied access to command.", sender.getName()));
+ ess.getLogger().log(Level.WARNING, _("§c{0} §4was denied access to command.", sender.getName()));
sender.sendMessage(_("§4You do not have access to that command."));
return true;
}
@@ -163,7 +162,7 @@ public class EssentialsCommandHandler implements ICommandHandler, TabExecutor
}
catch (Exception ex)
{
- LOGGER.log(Level.SEVERE, _("Command {0} failed:", commandLabel), ex);
+ ess.getLogger().log(Level.SEVERE, _("Command {0} failed:", commandLabel), ex);
return true;
}
}
@@ -237,7 +236,7 @@ public class EssentialsCommandHandler implements ICommandHandler, TabExecutor
catch (Exception ex)
{
sender.sendMessage(_("§4Command {0} is improperly loaded.", commandName));
- LOGGER.log(Level.SEVERE, _("§4Command {0} is improperly loaded.", commandName), ex);
+ ess.getLogger().log(Level.SEVERE, _("§4Command {0} is improperly loaded.", commandName), ex);
return null;
}
}
@@ -245,7 +244,7 @@ public class EssentialsCommandHandler implements ICommandHandler, TabExecutor
// Check authorization
if (sender != null && !cmd.isAuthorized(sender))
{
- LOGGER.log(Level.WARNING, _("§c{0} §4was denied access to command.", sender.getName()));
+ ess.getLogger().log(Level.WARNING, _("§c{0} §4was denied access to command.", sender.getName()));
sender.sendMessage(_("§4You do not have access to that command."));
return null;
}
@@ -279,7 +278,7 @@ public class EssentialsCommandHandler implements ICommandHandler, TabExecutor
}
catch (Exception ex)
{
- LOGGER.log(Level.SEVERE, _("Command {0} failed:", commandLabel), ex);
+ ess.getLogger().log(Level.SEVERE, _("Command {0} failed:", commandLabel), ex);
return null;
}
}
@@ -290,7 +289,7 @@ public class EssentialsCommandHandler implements ICommandHandler, TabExecutor
sender.sendMessage(_("§cError:§4 {0}", exception.getMessage()));
if (ess.getSettings().isDebug())
{
- LOGGER.log(Level.WARNING, _("Error calling command /{0}", commandLabel), exception);
+ ess.getLogger().log(Level.WARNING, _("Error calling command /{0}", commandLabel), exception);
}
}
@@ -400,7 +399,7 @@ public class EssentialsCommandHandler implements ICommandHandler, TabExecutor
final String altString = pc.getPlugin().getName() + ":" + pc.getLabel();
if (ess.getSettings().isDebug())
{
- LOGGER.log(Level.INFO, "Essentials: Alternative command " + label + " found, using " + altString); //TODO: TL key?
+ ess.getLogger().log(Level.INFO, "Essentials: Alternative command " + label + " found, using " + altString); //TODO: TL key?
}
disabledList.put(label, altString);
}
diff --git a/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java b/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java
index 8b74e1af7..d2d3a5357 100644
--- a/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java
+++ b/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java
@@ -39,7 +39,6 @@ import org.bukkit.inventory.ItemStack;
public class EssentialsPlayerListener implements Listener
{
- private static final Logger LOGGER = Logger.getLogger("Minecraft");
private final Server server;
private final IEssentials ess;
private final IUserMap userMap;
@@ -73,7 +72,7 @@ public class EssentialsPlayerListener implements Listener
{
event.setCancelled(true);
user.sendMessage(_("§6You have been muted!"));
- LOGGER.info(_("{0} tried to speak, but is muted.", user.getName()));
+ ess.getLogger().info(_("{0} tried to speak, but is muted.", user.getName()));
}
final Iterator<Player> it = event.getRecipients().iterator();
while (it.hasNext())
@@ -306,11 +305,11 @@ public class EssentialsPlayerListener implements Listener
{
if (ess.getSettings().isDebug())
{
- LOGGER.log(Level.WARNING, ex.getMessage(), ex);
+ ess.getLogger().log(Level.WARNING, ex.getMessage(), ex);
}
else
{
- LOGGER.log(Level.WARNING, ex.getMessage());
+ ess.getLogger().log(Level.WARNING, ex.getMessage());
}
}
}
diff --git a/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileReader.java b/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileReader.java
index 6f88f9c8c..e3bebfeac 100644
--- a/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileReader.java
+++ b/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileReader.java
@@ -56,7 +56,7 @@ public abstract class AbstractDelayedYamlFileReader<T extends StorageObject> imp
}
catch (IOException ex)
{
- Bukkit.getLogger().log(Level.SEVERE, "File can't be closed: " + file.toString(), ex);
+ ess.getLogger().log(Level.SEVERE, "File can't be closed: " + file.toString(), ex);
}
}
@@ -64,14 +64,14 @@ public abstract class AbstractDelayedYamlFileReader<T extends StorageObject> imp
catch (FileNotFoundException ex)
{
onException(ex);
- Bukkit.getLogger().log(Level.INFO, "File not found: " + file.toString());
+ ess.getLogger().log(Level.INFO, "File not found: " + file.toString());
}
catch (ObjectLoadException ex)
{
onException(ex);
File broken = new File(file.getAbsolutePath() + ".broken." + System.currentTimeMillis());
file.renameTo(broken);
- Bukkit.getLogger().log(Level.SEVERE, "The file " + file.toString() + " is broken, it has been renamed to " + broken.toString(), ex.getCause());
+ ess.getLogger().log(Level.SEVERE, "The file " + file.toString() + " is broken, it has been renamed to " + broken.toString(), ex.getCause());
}
}
}
diff --git a/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileWriter.java b/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileWriter.java
index 0ce4750a7..19962373e 100644
--- a/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileWriter.java
+++ b/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileWriter.java
@@ -48,7 +48,7 @@ public abstract class AbstractDelayedYamlFileWriter implements Runnable
}
catch (FileNotFoundException ex)
{
- Bukkit.getLogger().log(Level.SEVERE, file.toString(), ex);
+ ess.getLogger().log(Level.SEVERE, file.toString(), ex);
}
finally
{
diff --git a/Essentials/src/net/ess3/storage/AsyncStorageObjectHolder.java b/Essentials/src/net/ess3/storage/AsyncStorageObjectHolder.java
index b4a82b2bc..097b06308 100644
--- a/Essentials/src/net/ess3/storage/AsyncStorageObjectHolder.java
+++ b/Essentials/src/net/ess3/storage/AsyncStorageObjectHolder.java
@@ -32,7 +32,7 @@ public abstract class AsyncStorageObjectHolder<T extends StorageObject> implemen
}
catch (Exception ex)
{
- Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
+ ess.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
}
}
@@ -175,7 +175,7 @@ public abstract class AsyncStorageObjectHolder<T extends StorageObject> implemen
}
catch (Exception ex)
{
- Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
+ ess.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
}
}
loaded.set(true);
diff --git a/Essentials/src/net/ess3/storage/ManagedFile.java b/Essentials/src/net/ess3/storage/ManagedFile.java
index 9e13bbc3b..29e74102e 100644
--- a/Essentials/src/net/ess3/storage/ManagedFile.java
+++ b/Essentials/src/net/ess3/storage/ManagedFile.java
@@ -19,9 +19,11 @@ public class ManagedFile
{
private final static int BUFFERSIZE = 1024 * 8;
private final File file;
+ protected final IEssentials ess;
public ManagedFile(final String filename, final IEssentials ess)
{
+ this.ess = ess;
file = new File(ess.getPlugin().getDataFolder(), filename);
if (file.exists())
@@ -35,7 +37,7 @@ public class ManagedFile
}
catch (IOException ex)
{
- Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
+ ess.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
}
}
@@ -47,7 +49,7 @@ public class ManagedFile
}
catch (IOException ex)
{
- Bukkit.getLogger().log(Level.SEVERE, _("Could not load items.csv!"), ex);
+ ess.getLogger().log(Level.SEVERE, _("Could not load items.csv!"), ex);
}
}
}
@@ -157,7 +159,8 @@ 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
@@ -222,7 +225,7 @@ public class ManagedFile
}
catch (IOException ex)
{
- Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
+ ess.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
return Collections.emptyList();
}
}
diff --git a/Essentials/src/net/ess3/utils/textreader/HelpInput.java b/Essentials/src/net/ess3/utils/textreader/HelpInput.java
index 334b1d0cd..eab35a677 100644
--- a/Essentials/src/net/ess3/utils/textreader/HelpInput.java
+++ b/Essentials/src/net/ess3/utils/textreader/HelpInput.java
@@ -15,16 +15,17 @@ import org.bukkit.plugin.PluginDescriptionFile;
public class HelpInput implements IText
{
+ protected final IEssentials ess;
private static final String DESCRIPTION = "description";
private static final String PERMISSION = "permission";
private static final String PERMISSIONS = "permissions";
private final List<String> lines = new ArrayList<String>();
private final List<String> chapters = new ArrayList<String>();
private final Map<String, Integer> bookmarks = new HashMap<String, Integer>();
- private final static Logger logger = Logger.getLogger("Minecraft");
public HelpInput(final IUser user, final String match, final IEssentials ess) throws IOException
{
+ this.ess = ess;
final ISettings settings = ess.getSettings();
boolean reported = false;
final List<String> newLines = new ArrayList<String>();
@@ -147,7 +148,7 @@ public class HelpInput implements IText
{
if (!reported)
{
- logger.log(Level.WARNING, _("Error getting help for plugin: {0}", pluginNameLow), ex);
+ ess.getLogger().log(Level.WARNING, _("Error getting help for plugin: {0}", pluginNameLow), ex);
}
reported = true;
continue;