mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-05 12:02:53 +00:00
Throw console warning on slow economy api call.
This commit is contained in:
parent
3042151fee
commit
af2c514f2a
1 changed files with 13 additions and 1 deletions
|
@ -187,7 +187,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||||
|
|
||||||
public boolean canAfford(final BigDecimal cost, final boolean permcheck)
|
public boolean canAfford(final BigDecimal cost, final boolean permcheck)
|
||||||
{
|
{
|
||||||
if (cost.signum() <= 0)
|
if (cost.signum() <= 0)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -393,6 +393,18 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BigDecimal getMoney()
|
public BigDecimal getMoney()
|
||||||
|
{
|
||||||
|
final long start = System.nanoTime();
|
||||||
|
final BigDecimal value = _getMoney();
|
||||||
|
final long elapsed = start - System.nanoTime();
|
||||||
|
if (elapsed > 20000000L)
|
||||||
|
{
|
||||||
|
ess.getLogger().log(Level.INFO, "Lag Notice - Slow Economy Response - Request took over {0}ms!", elapsed / 1000000);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private BigDecimal _getMoney()
|
||||||
{
|
{
|
||||||
if (ess.getPaymentMethod().hasMethod())
|
if (ess.getPaymentMethod().hasMethod())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue