Extend eco disable option to block eco lookups. This can be required to combat slow SQL economies.

This option is not recommended under normal circumstances.
This commit is contained in:
KHobbits 2013-08-28 17:50:28 +01:00
parent 3fb4d1f3bf
commit eca3be5cf3
2 changed files with 48 additions and 12 deletions

View File

@ -518,6 +518,7 @@ public class Settings implements net.ess3.api.ISettings
economyLagWarning = _getEconomyLagWarning();
economyLog = _isEcoLogEnabled();
economyLogUpdate = _isEcoLogUpdateEnabled();
economyDisabled = _isEcoDisabled();
}
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
@ -650,12 +651,18 @@ public class Settings implements net.ess3.api.ISettings
{
return config.getBoolean("trade-in-stacks-" + id, false);
}
// #easteregg
private boolean economyDisabled = false;
public boolean _isEcoDisabled()
{
return config.getBoolean("disable-eco", false);
}
@Override
public boolean isEcoDisabled()
{
return config.getBoolean("disable-eco", false);
return economyDisabled;
}
@Override

View File

@ -49,8 +49,9 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
{
afkPosition = getLocation();
}
if (isOnline()) {
lastOnlineActivity = System.currentTimeMillis();
if (isOnline())
{
lastOnlineActivity = System.currentTimeMillis();
}
}
@ -240,12 +241,14 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
teleportRequestTime = System.currentTimeMillis();
teleportRequester = player == null ? null : player.getName();
teleportRequestHere = here;
if (player == null) {
if (player == null)
{
teleportLocation = null;
}
else {
else
{
teleportLocation = here ? player.getLocation() : this.getLocation();
}
}
}
public String getTeleportRequest()
@ -257,7 +260,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
{
return teleportRequestHere;
}
public Location getTpRequestLocation()
{
return teleportLocation;
@ -392,6 +395,14 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
private BigDecimal _getMoney()
{
if (ess.getSettings().isEcoDisabled())
{
if (ess.getSettings().isDebug())
{
ess.getLogger().info("Internal economy functions disabled, aborting balance check.");
}
return BigDecimal.ZERO;
}
if (ess.getPaymentMethod().hasMethod())
{
try
@ -414,6 +425,14 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
@Override
public void setMoney(final BigDecimal value)
{
if (ess.getSettings().isEcoDisabled())
{
if (ess.getSettings().isDebug())
{
ess.getLogger().info("Internal economy functions disabled, aborting balance change.");
}
return;
}
if (ess.getPaymentMethod().hasMethod())
{
try
@ -436,6 +455,14 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
public void updateMoneyCache(final BigDecimal value)
{
if (ess.getSettings().isEcoDisabled())
{
if (ess.getSettings().isDebug())
{
ess.getLogger().info("Internal economy functions disabled, aborting balance sync.");
}
return;
}
if (ess.getPaymentMethod().hasMethod() && super.getMoney() != value)
{
super.setMoney(value);
@ -765,14 +792,16 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
{
this.recipeSee = recipeSee;
}
@Override
public void sendMessage(String message) {
if (!message.isEmpty()) {
public void sendMessage(String message)
{
if (!message.isEmpty())
{
base.sendMessage(message);
}
}
@Override
public void setReplyTo(final CommandSender user)
{