mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-25 10:38:00 +01:00
Make the lag warning configurable, useful to debug economy lag on larger servers.
This commit is contained in:
parent
af2c514f2a
commit
8ebe55a294
@ -187,6 +187,8 @@ public interface ISettings extends IConf
|
|||||||
|
|
||||||
public int getMailsPerMinute();
|
public int getMailsPerMinute();
|
||||||
|
|
||||||
|
public long getEconomyLagWarning();
|
||||||
|
|
||||||
public void setEssentialsChatActive(boolean b);
|
public void setEssentialsChatActive(boolean b);
|
||||||
|
|
||||||
long getMaxTempban();
|
long getMaxTempban();
|
||||||
|
@ -461,15 +461,18 @@ public class Settings implements ISettings
|
|||||||
if (config.isConfigurationSection("list"))
|
if (config.isConfigurationSection("list"))
|
||||||
{
|
{
|
||||||
Map<String, Object> values = config.getConfigurationSection("list").getValues(false);
|
Map<String, Object> values = config.getConfigurationSection("list").getValues(false);
|
||||||
if (!values.isEmpty()) {
|
if (!values.isEmpty())
|
||||||
|
{
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Map<String, Object> defaultMap = new HashMap<String, Object>();
|
Map<String, Object> defaultMap = new HashMap<String, Object>();
|
||||||
if (config.getBoolean("sort-list-by-groups", false)) {
|
if (config.getBoolean("sort-list-by-groups", false))
|
||||||
|
{
|
||||||
defaultMap.put("ListByGroup", "ListByGroup");
|
defaultMap.put("ListByGroup", "ListByGroup");
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
defaultMap.put("Players", "*");
|
defaultMap.put("Players", "*");
|
||||||
}
|
}
|
||||||
return defaultMap;
|
return defaultMap;
|
||||||
@ -510,6 +513,9 @@ public class Settings implements ISettings
|
|||||||
mailsPerMinute = _getMailsPerMinute();
|
mailsPerMinute = _getMailsPerMinute();
|
||||||
maxMoney = _getMaxMoney();
|
maxMoney = _getMaxMoney();
|
||||||
minMoney = _getMinMoney();
|
minMoney = _getMinMoney();
|
||||||
|
economyLagWarning = _getEconomyLagWarning();
|
||||||
|
economyLog = _isEcoLogEnabled();
|
||||||
|
economyLogUpdate = _isEcoLogUpdateEnabled();
|
||||||
}
|
}
|
||||||
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
|
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
|
||||||
|
|
||||||
@ -636,12 +642,14 @@ public class Settings implements ISettings
|
|||||||
return config.getString("currency-symbol", "$").concat("$").substring(0, 1).replaceAll("[0-9]", "$");
|
return config.getString("currency-symbol", "$").concat("$").substring(0, 1).replaceAll("[0-9]", "$");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #easteregg
|
||||||
@Override
|
@Override
|
||||||
public boolean isTradeInStacks(int id)
|
public boolean isTradeInStacks(int id)
|
||||||
{
|
{
|
||||||
return config.getBoolean("trade-in-stacks-" + id, false);
|
return config.getBoolean("trade-in-stacks-" + id, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #easteregg
|
||||||
@Override
|
@Override
|
||||||
public boolean isEcoDisabled()
|
public boolean isEcoDisabled()
|
||||||
{
|
{
|
||||||
@ -721,15 +729,28 @@ public class Settings implements ISettings
|
|||||||
{
|
{
|
||||||
return minMoney;
|
return minMoney;
|
||||||
}
|
}
|
||||||
|
private boolean economyLog = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEcoLogEnabled()
|
public boolean isEcoLogEnabled()
|
||||||
|
{
|
||||||
|
return economyLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean _isEcoLogEnabled()
|
||||||
{
|
{
|
||||||
return config.getBoolean("economy-log-enabled", false);
|
return config.getBoolean("economy-log-enabled", false);
|
||||||
}
|
}
|
||||||
|
// #easteregg
|
||||||
|
private boolean economyLogUpdate = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEcoLogUpdateEnabled()
|
public boolean isEcoLogUpdateEnabled()
|
||||||
|
{
|
||||||
|
return economyLogUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean _isEcoLogUpdateEnabled()
|
||||||
{
|
{
|
||||||
return config.getBoolean("economy-log-update-enabled", false);
|
return config.getBoolean("economy-log-update-enabled", false);
|
||||||
}
|
}
|
||||||
@ -794,6 +815,7 @@ public class Settings implements ISettings
|
|||||||
{
|
{
|
||||||
return prefixsuffixconfigured ? addprefixsuffix : essentialsChatActive;
|
return prefixsuffixconfigured ? addprefixsuffix : essentialsChatActive;
|
||||||
}
|
}
|
||||||
|
// #easteregg
|
||||||
private boolean disablePrefix = false;
|
private boolean disablePrefix = false;
|
||||||
|
|
||||||
private boolean _disablePrefix()
|
private boolean _disablePrefix()
|
||||||
@ -806,6 +828,7 @@ public class Settings implements ISettings
|
|||||||
{
|
{
|
||||||
return disablePrefix;
|
return disablePrefix;
|
||||||
}
|
}
|
||||||
|
// #easteregg
|
||||||
private boolean disableSuffix = false;
|
private boolean disableSuffix = false;
|
||||||
|
|
||||||
private boolean _disableSuffix()
|
private boolean _disableSuffix()
|
||||||
@ -1035,8 +1058,6 @@ public class Settings implements ISettings
|
|||||||
return maxSpeed > 1.0 ? 1.0 : Math.abs(maxSpeed);
|
return maxSpeed > 1.0 ? 1.0 : Math.abs(maxSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
//This option does not exist in the config.yml because it wasn't yet implemented in bukkit
|
|
||||||
//The code was commented out in the /speed command
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxWalkSpeed()
|
public double getMaxWalkSpeed()
|
||||||
{
|
{
|
||||||
@ -1055,6 +1076,19 @@ public class Settings implements ISettings
|
|||||||
{
|
{
|
||||||
return mailsPerMinute;
|
return mailsPerMinute;
|
||||||
}
|
}
|
||||||
|
// #easteregg
|
||||||
|
private long economyLagWarning;
|
||||||
|
|
||||||
|
private long _getEconomyLagWarning()
|
||||||
|
{
|
||||||
|
return config.getLong("economy-lag-warning", 20000000L); // Default to 20ms
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getEconomyLagWarning()
|
||||||
|
{
|
||||||
|
return economyLagWarning;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getMaxTempban()
|
public long getMaxTempban()
|
||||||
|
@ -396,8 +396,8 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||||||
{
|
{
|
||||||
final long start = System.nanoTime();
|
final long start = System.nanoTime();
|
||||||
final BigDecimal value = _getMoney();
|
final BigDecimal value = _getMoney();
|
||||||
final long elapsed = start - System.nanoTime();
|
final long elapsed = System.nanoTime() - start;
|
||||||
if (elapsed > 20000000L)
|
if (elapsed > ess.getSettings().getEconomyLagWarning())
|
||||||
{
|
{
|
||||||
ess.getLogger().log(Level.INFO, "Lag Notice - Slow Economy Response - Request took over {0}ms!", elapsed / 1000000);
|
ess.getLogger().log(Level.INFO, "Lag Notice - Slow Economy Response - Request took over {0}ms!", elapsed / 1000000);
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ public class Commandbalancetop extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
lock.readLock().unlock();
|
lock.readLock().unlock();
|
||||||
}
|
}
|
||||||
ess.runTaskAsynchronously(new Calculator(new Viewer(sender, page, force), force));
|
ess.runTaskAsynchronously(new Calculator(new Viewer(sender, page, false), force));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user