summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2013-05-05 22:37:28 +0100
committerKHobbits <rob@khobbits.co.uk>2013-05-05 22:37:28 +0100
commited5743147b9874cc5a735f373f0621fdb17e1b6f (patch)
tree18f9fda42b6cd3a476aa8445b25e50086eefbd26
parent1bb7946e1303919af03bac748e96e6f7b07df2ec (diff)
downloadEssentials-ed5743147b9874cc5a735f373f0621fdb17e1b6f.tar
Essentials-ed5743147b9874cc5a735f373f0621fdb17e1b6f.tar.gz
Essentials-ed5743147b9874cc5a735f373f0621fdb17e1b6f.tar.lz
Essentials-ed5743147b9874cc5a735f373f0621fdb17e1b6f.tar.xz
Essentials-ed5743147b9874cc5a735f373f0621fdb17e1b6f.zip
Add some sign debugging to /ess debug to help track down charging issues.
-rw-r--r--Essentials/src/com/earth2me/essentials/Trade.java27
1 files changed, 23 insertions, 4 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Trade.java b/Essentials/src/com/earth2me/essentials/Trade.java
index 7a71d60cc..a770bfc29 100644
--- a/Essentials/src/com/earth2me/essentials/Trade.java
+++ b/Essentials/src/com/earth2me/essentials/Trade.java
@@ -122,6 +122,10 @@ public class Trade
boolean success = true;
if (getMoney() != null && getMoney().signum() > 0)
{
+ if (ess.getSettings().isDebug())
+ {
+ ess.getLogger().log(Level.INFO, "paying user " + user.getName() + " via trade " + getMoney().toPlainString());
+ }
user.giveMoney(getMoney());
}
if (getItemStack() != null)
@@ -167,11 +171,14 @@ public class Trade
{
if (ess.getSettings().isDebug())
{
- ess.getLogger().log(Level.INFO, "charging user " + user.getName());
+ ess.getLogger().log(Level.INFO, "attempting to charge user " + user.getName());
}
-
if (getMoney() != null)
{
+ if (ess.getSettings().isDebug())
+ {
+ ess.getLogger().log(Level.INFO, "charging user " + user.getName() + " money " + getMoney().toPlainString());
+ }
if (!user.canAfford(getMoney()) && getMoney().signum() > 0)
{
throw new ChargeException(_("notEnoughMoney"));
@@ -180,7 +187,11 @@ public class Trade
}
if (getItemStack() != null)
{
- if (!user.getInventory().containsAtLeast(itemStack, itemStack.getAmount()))
+ if (ess.getSettings().isDebug())
+ {
+ ess.getLogger().log(Level.INFO, "charging user " + user.getName() + " itemstack " + getItemStack().toString());
+ }
+ if (!user.getInventory().containsAtLeast(getItemStack(), getItemStack().getAmount()))
{
throw new ChargeException(_("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase(Locale.ENGLISH).replace("_", " ")));
}
@@ -198,6 +209,10 @@ public class Trade
}
if (getExperience() != null)
{
+ if (ess.getSettings().isDebug())
+ {
+ ess.getLogger().log(Level.INFO, "charging user " + user.getName() + " exp " + getExperience());
+ }
final int experience = SetExpFix.getTotalExperience(user);
if (experience < getExperience() && getExperience() > 0)
{
@@ -205,6 +220,10 @@ public class Trade
}
SetExpFix.setTotalExperience(user, experience - getExperience());
}
+ if (ess.getSettings().isDebug())
+ {
+ ess.getLogger().log(Level.INFO, "charge user " + user.getName() + " completed");
+ }
}
public BigDecimal getMoney()
@@ -254,7 +273,7 @@ public class Trade
}
}
if (cost.signum() != 0 && (user.isAuthorized("essentials.nocommandcost.all")
- || user.isAuthorized("essentials.nocommandcost." + command)))
+ || user.isAuthorized("essentials.nocommandcost." + command)))
{
return BigDecimal.ZERO;
}