More debug messages, if debug: true is set.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1521 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo 2011-05-22 20:27:09 +00:00
parent 1c5d9b1db0
commit d5a0cc5cb0
7 changed files with 58 additions and 1 deletions

View File

@ -460,7 +460,7 @@ public class Essentials extends JavaPlugin
}
catch (Throwable ex)
{
sender.sendMessage(ChatColor.RED + "Error: " + ex.getMessage());
sender.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (getSettings().isDebug())
{
logger.log(Level.WARNING, Util.format("errorCallingCommand", commandLabel), ex);

View File

@ -1,6 +1,8 @@
package com.earth2me.essentials;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.*;
import org.bukkit.block.*;
import org.bukkit.craftbukkit.block.CraftSign;
@ -11,6 +13,7 @@ import org.bukkit.inventory.ItemStack;
public class EssentialsBlockListener extends BlockListener
{
private final Essentials ess;
private static final Logger logger = Logger.getLogger("Minecraft");
public final static ArrayList<Material> protectedBlocks = new ArrayList<Material>(4);
static
@ -150,6 +153,10 @@ public class EssentialsBlockListener extends BlockListener
catch (Throwable ex)
{
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
}
}

View File

@ -1,5 +1,7 @@
package com.earth2me.essentials;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Material;
import org.bukkit.block.Sign;
import org.bukkit.craftbukkit.block.CraftSign;
@ -12,6 +14,7 @@ import org.bukkit.inventory.ItemStack;
public class EssentialsEcoBlockListener extends BlockListener
{
Essentials ess;
private static final Logger logger = Logger.getLogger("Minecraft");
public EssentialsEcoBlockListener(Essentials ess)
{
@ -88,6 +91,10 @@ public class EssentialsEcoBlockListener extends BlockListener
catch (Throwable ex)
{
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
}
return;
}
@ -120,6 +127,10 @@ public class EssentialsEcoBlockListener extends BlockListener
catch (Throwable ex)
{
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
event.setLine(0, "§4[Buy]");
event.setLine(1, "#");
event.setLine(2, "Item");
@ -145,6 +156,10 @@ public class EssentialsEcoBlockListener extends BlockListener
catch (Throwable ex)
{
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
event.setLine(0, "§4[Sell]");
event.setLine(1, "#");
event.setLine(2, "Item");
@ -202,6 +217,10 @@ public class EssentialsEcoBlockListener extends BlockListener
catch (Throwable ex)
{
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
event.setLine(0, "§4[Trade]");
event.setLine(1, "# ItemOr" + ess.getSettings().getCurrencySymbol());
event.setLine(2, "# ItemOr" + ess.getSettings().getCurrencySymbol() + ":#");

View File

@ -1,6 +1,8 @@
package com.earth2me.essentials;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Material;
import org.bukkit.block.Sign;
import org.bukkit.craftbukkit.block.CraftSign;
@ -13,6 +15,7 @@ import org.bukkit.inventory.ItemStack;
public class EssentialsEcoPlayerListener extends PlayerListener
{
Essentials ess;
private static final Logger logger = Logger.getLogger("Minecraft");
EssentialsEcoPlayerListener(Essentials ess)
{
@ -60,6 +63,10 @@ public class EssentialsEcoPlayerListener extends PlayerListener
catch (Throwable ex)
{
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
}
return;
}
@ -83,6 +90,10 @@ public class EssentialsEcoPlayerListener extends PlayerListener
catch (Throwable ex)
{
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
}
return;
}
@ -189,6 +200,10 @@ public class EssentialsEcoPlayerListener extends PlayerListener
catch (Throwable ex)
{
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
}
return;
}

View File

@ -478,6 +478,10 @@ public class EssentialsPlayerListener extends PlayerListener
catch (Throwable ex)
{
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
}
}

View File

@ -2,6 +2,8 @@ package com.earth2me.essentials;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
@ -46,6 +48,7 @@ public class Teleport implements Runnable
private Target teleportTarget;
private Charge chargeFor;
private Essentials ess;
private static final Logger logger = Logger.getLogger("Minecraft");
private void initTimer(long delay, Target target, Charge chargeFor)
{
@ -97,6 +100,10 @@ public class Teleport implements Runnable
catch (Throwable ex)
{
user.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
}
return;
}

View File

@ -3,6 +3,7 @@ package com.earth2me.essentials.commands;
import org.bukkit.Server;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.logging.Level;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -50,6 +51,10 @@ public class Commandtpall extends EssentialsCommand
catch (Exception ex)
{
sender.sendMessage(Util.format("errorWithMessage", ex.getMessage()));
if (ess.getSettings().isDebug())
{
logger.log(Level.WARNING, ex.getMessage(), ex);
}
}
}
}