mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-07 19:40:23 +01:00
Add some sign debugging to /ess debug to help track down charging issues.
This commit is contained in:
parent
1bb7946e13
commit
ed5743147b
@ -122,6 +122,10 @@ public class Trade
|
|||||||
boolean success = true;
|
boolean success = true;
|
||||||
if (getMoney() != null && getMoney().signum() > 0)
|
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());
|
user.giveMoney(getMoney());
|
||||||
}
|
}
|
||||||
if (getItemStack() != null)
|
if (getItemStack() != null)
|
||||||
@ -167,11 +171,14 @@ public class Trade
|
|||||||
{
|
{
|
||||||
if (ess.getSettings().isDebug())
|
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 (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)
|
if (!user.canAfford(getMoney()) && getMoney().signum() > 0)
|
||||||
{
|
{
|
||||||
throw new ChargeException(_("notEnoughMoney"));
|
throw new ChargeException(_("notEnoughMoney"));
|
||||||
@ -180,7 +187,11 @@ public class Trade
|
|||||||
}
|
}
|
||||||
if (getItemStack() != null)
|
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("_", " ")));
|
throw new ChargeException(_("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase(Locale.ENGLISH).replace("_", " ")));
|
||||||
}
|
}
|
||||||
@ -198,6 +209,10 @@ public class Trade
|
|||||||
}
|
}
|
||||||
if (getExperience() != null)
|
if (getExperience() != null)
|
||||||
{
|
{
|
||||||
|
if (ess.getSettings().isDebug())
|
||||||
|
{
|
||||||
|
ess.getLogger().log(Level.INFO, "charging user " + user.getName() + " exp " + getExperience());
|
||||||
|
}
|
||||||
final int experience = SetExpFix.getTotalExperience(user);
|
final int experience = SetExpFix.getTotalExperience(user);
|
||||||
if (experience < getExperience() && getExperience() > 0)
|
if (experience < getExperience() && getExperience() > 0)
|
||||||
{
|
{
|
||||||
@ -205,6 +220,10 @@ public class Trade
|
|||||||
}
|
}
|
||||||
SetExpFix.setTotalExperience(user, experience - getExperience());
|
SetExpFix.setTotalExperience(user, experience - getExperience());
|
||||||
}
|
}
|
||||||
|
if (ess.getSettings().isDebug())
|
||||||
|
{
|
||||||
|
ess.getLogger().log(Level.INFO, "charge user " + user.getName() + " completed");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getMoney()
|
public BigDecimal getMoney()
|
||||||
|
Loading…
Reference in New Issue
Block a user