mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-14 02:24:16 +02:00
Use proper logging.
This commit is contained in:
@@ -126,7 +126,7 @@ public class I18n implements II18n
|
|||||||
currentLocale = new Locale(parts[0], parts[1], parts[2]);
|
currentLocale = new Locale(parts[0], parts[1], parts[2]);
|
||||||
}
|
}
|
||||||
ResourceBundle.clearCache();
|
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));
|
customBundle = ResourceBundle.getBundle(MESSAGES, currentLocale, new FileResClassLoader(I18n.class.getClassLoader(), ess));
|
||||||
localeBundle = ResourceBundle.getBundle(MESSAGES, currentLocale);
|
localeBundle = ResourceBundle.getBundle(MESSAGES, currentLocale);
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,6 @@ import org.bukkit.plugin.PluginManager;
|
|||||||
|
|
||||||
public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> implements IJails
|
public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> implements IJails
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Bukkit.getLogger();
|
|
||||||
|
|
||||||
public Jails(final IEssentials ess)
|
public Jails(final IEssentials ess)
|
||||||
{
|
{
|
||||||
@@ -174,11 +173,11 @@ public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> imp
|
|||||||
{
|
{
|
||||||
if (ess.getSettings().isDebug())
|
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
|
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())
|
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
|
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."));
|
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())
|
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
|
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."));
|
user.sendMessage(_("§4You do the crime, you do the time."));
|
||||||
|
@@ -17,7 +17,6 @@ public class EssentialsCommandHandler implements ICommandHandler, TabExecutor
|
|||||||
private final ClassLoader classLoader;
|
private final ClassLoader classLoader;
|
||||||
private final String commandPath;
|
private final String commandPath;
|
||||||
private final String permissionPrefix;// TODO: Needed?
|
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, List<PluginCommand>> altcommands = new HashMap<String, List<PluginCommand>>();
|
||||||
private final Map<String, String> disabledList = new HashMap<String, String>();
|
private final Map<String, String> disabledList = new HashMap<String, String>();
|
||||||
private final Map<String, IEssentialsCommand> commands = new HashMap<String, IEssentialsCommand>();
|
private final Map<String, IEssentialsCommand> commands = new HashMap<String, IEssentialsCommand>();
|
||||||
@@ -106,7 +105,7 @@ public class EssentialsCommandHandler implements ICommandHandler, TabExecutor
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
sender.sendMessage(_("§4Command {0} is improperly loaded.", commandName));
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,7 +113,7 @@ public class EssentialsCommandHandler implements ICommandHandler, TabExecutor
|
|||||||
// Check authorization
|
// Check authorization
|
||||||
if (sender != null && !cmd.isAuthorized(sender))
|
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."));
|
sender.sendMessage(_("§4You do not have access to that command."));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -163,7 +162,7 @@ public class EssentialsCommandHandler implements ICommandHandler, TabExecutor
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, _("Command {0} failed:", commandLabel), ex);
|
ess.getLogger().log(Level.SEVERE, _("Command {0} failed:", commandLabel), ex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -237,7 +236,7 @@ public class EssentialsCommandHandler implements ICommandHandler, TabExecutor
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
sender.sendMessage(_("§4Command {0} is improperly loaded.", commandName));
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -245,7 +244,7 @@ public class EssentialsCommandHandler implements ICommandHandler, TabExecutor
|
|||||||
// Check authorization
|
// Check authorization
|
||||||
if (sender != null && !cmd.isAuthorized(sender))
|
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."));
|
sender.sendMessage(_("§4You do not have access to that command."));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -279,7 +278,7 @@ public class EssentialsCommandHandler implements ICommandHandler, TabExecutor
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, _("Command {0} failed:", commandLabel), ex);
|
ess.getLogger().log(Level.SEVERE, _("Command {0} failed:", commandLabel), ex);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -290,7 +289,7 @@ public class EssentialsCommandHandler implements ICommandHandler, TabExecutor
|
|||||||
sender.sendMessage(_("§cError:§4 {0}", exception.getMessage()));
|
sender.sendMessage(_("§cError:§4 {0}", exception.getMessage()));
|
||||||
if (ess.getSettings().isDebug())
|
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();
|
final String altString = pc.getPlugin().getName() + ":" + pc.getLabel();
|
||||||
if (ess.getSettings().isDebug())
|
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);
|
disabledList.put(label, altString);
|
||||||
}
|
}
|
||||||
|
@@ -39,7 +39,6 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class EssentialsPlayerListener implements Listener
|
public class EssentialsPlayerListener implements Listener
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
|
||||||
private final Server server;
|
private final Server server;
|
||||||
private final IEssentials ess;
|
private final IEssentials ess;
|
||||||
private final IUserMap userMap;
|
private final IUserMap userMap;
|
||||||
@@ -73,7 +72,7 @@ public class EssentialsPlayerListener implements Listener
|
|||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
user.sendMessage(_("§6You have been muted!"));
|
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();
|
final Iterator<Player> it = event.getRecipients().iterator();
|
||||||
while (it.hasNext())
|
while (it.hasNext())
|
||||||
@@ -306,11 +305,11 @@ public class EssentialsPlayerListener implements Listener
|
|||||||
{
|
{
|
||||||
if (ess.getSettings().isDebug())
|
if (ess.getSettings().isDebug())
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, ex.getMessage(), ex);
|
ess.getLogger().log(Level.WARNING, ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, ex.getMessage());
|
ess.getLogger().log(Level.WARNING, ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -56,7 +56,7 @@ public abstract class AbstractDelayedYamlFileReader<T extends StorageObject> imp
|
|||||||
}
|
}
|
||||||
catch (IOException ex)
|
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)
|
catch (FileNotFoundException ex)
|
||||||
{
|
{
|
||||||
onException(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)
|
catch (ObjectLoadException ex)
|
||||||
{
|
{
|
||||||
onException(ex);
|
onException(ex);
|
||||||
File broken = new File(file.getAbsolutePath() + ".broken." + System.currentTimeMillis());
|
File broken = new File(file.getAbsolutePath() + ".broken." + System.currentTimeMillis());
|
||||||
file.renameTo(broken);
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -48,7 +48,7 @@ public abstract class AbstractDelayedYamlFileWriter implements Runnable
|
|||||||
}
|
}
|
||||||
catch (FileNotFoundException ex)
|
catch (FileNotFoundException ex)
|
||||||
{
|
{
|
||||||
Bukkit.getLogger().log(Level.SEVERE, file.toString(), ex);
|
ess.getLogger().log(Level.SEVERE, file.toString(), ex);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@@ -32,7 +32,7 @@ public abstract class AsyncStorageObjectHolder<T extends StorageObject> implemen
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
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)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
|
ess.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loaded.set(true);
|
loaded.set(true);
|
||||||
|
@@ -19,9 +19,11 @@ public class ManagedFile
|
|||||||
{
|
{
|
||||||
private final static int BUFFERSIZE = 1024 * 8;
|
private final static int BUFFERSIZE = 1024 * 8;
|
||||||
private final File file;
|
private final File file;
|
||||||
|
protected final IEssentials ess;
|
||||||
|
|
||||||
public ManagedFile(final String filename, final IEssentials ess)
|
public ManagedFile(final String filename, final IEssentials ess)
|
||||||
{
|
{
|
||||||
|
this.ess = ess;
|
||||||
file = new File(ess.getPlugin().getDataFolder(), filename);
|
file = new File(ess.getPlugin().getDataFolder(), filename);
|
||||||
|
|
||||||
if (file.exists())
|
if (file.exists())
|
||||||
@@ -35,7 +37,7 @@ public class ManagedFile
|
|||||||
}
|
}
|
||||||
catch (IOException ex)
|
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)
|
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
|
else
|
||||||
{
|
{
|
||||||
Bukkit.getLogger().warning(
|
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
|
finally
|
||||||
@@ -222,7 +225,7 @@ public class ManagedFile
|
|||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
|
ess.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -15,16 +15,17 @@ import org.bukkit.plugin.PluginDescriptionFile;
|
|||||||
|
|
||||||
public class HelpInput implements IText
|
public class HelpInput implements IText
|
||||||
{
|
{
|
||||||
|
protected final IEssentials ess;
|
||||||
private static final String DESCRIPTION = "description";
|
private static final String DESCRIPTION = "description";
|
||||||
private static final String PERMISSION = "permission";
|
private static final String PERMISSION = "permission";
|
||||||
private static final String PERMISSIONS = "permissions";
|
private static final String PERMISSIONS = "permissions";
|
||||||
private final List<String> lines = new ArrayList<String>();
|
private final List<String> lines = new ArrayList<String>();
|
||||||
private final List<String> chapters = new ArrayList<String>();
|
private final List<String> chapters = new ArrayList<String>();
|
||||||
private final Map<String, Integer> bookmarks = new HashMap<String, Integer>();
|
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
|
public HelpInput(final IUser user, final String match, final IEssentials ess) throws IOException
|
||||||
{
|
{
|
||||||
|
this.ess = ess;
|
||||||
final ISettings settings = ess.getSettings();
|
final ISettings settings = ess.getSettings();
|
||||||
boolean reported = false;
|
boolean reported = false;
|
||||||
final List<String> newLines = new ArrayList<String>();
|
final List<String> newLines = new ArrayList<String>();
|
||||||
@@ -147,7 +148,7 @@ public class HelpInput implements IText
|
|||||||
{
|
{
|
||||||
if (!reported)
|
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;
|
reported = true;
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user