mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-02-04 06:21:35 +01:00
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:
parent
3fb4d1f3bf
commit
eca3be5cf3
@ -518,6 +518,7 @@ public class Settings implements net.ess3.api.ISettings
|
|||||||
economyLagWarning = _getEconomyLagWarning();
|
economyLagWarning = _getEconomyLagWarning();
|
||||||
economyLog = _isEcoLogEnabled();
|
economyLog = _isEcoLogEnabled();
|
||||||
economyLogUpdate = _isEcoLogUpdateEnabled();
|
economyLogUpdate = _isEcoLogUpdateEnabled();
|
||||||
|
economyDisabled = _isEcoDisabled();
|
||||||
}
|
}
|
||||||
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
|
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
|
||||||
|
|
||||||
@ -652,10 +653,16 @@ public class Settings implements net.ess3.api.ISettings
|
|||||||
}
|
}
|
||||||
|
|
||||||
// #easteregg
|
// #easteregg
|
||||||
|
private boolean economyDisabled = false;
|
||||||
|
public boolean _isEcoDisabled()
|
||||||
|
{
|
||||||
|
return config.getBoolean("disable-eco", false);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEcoDisabled()
|
public boolean isEcoDisabled()
|
||||||
{
|
{
|
||||||
return config.getBoolean("disable-eco", false);
|
return economyDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,8 +49,9 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
|||||||
{
|
{
|
||||||
afkPosition = getLocation();
|
afkPosition = getLocation();
|
||||||
}
|
}
|
||||||
if (isOnline()) {
|
if (isOnline())
|
||||||
lastOnlineActivity = System.currentTimeMillis();
|
{
|
||||||
|
lastOnlineActivity = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,10 +241,12 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
|||||||
teleportRequestTime = System.currentTimeMillis();
|
teleportRequestTime = System.currentTimeMillis();
|
||||||
teleportRequester = player == null ? null : player.getName();
|
teleportRequester = player == null ? null : player.getName();
|
||||||
teleportRequestHere = here;
|
teleportRequestHere = here;
|
||||||
if (player == null) {
|
if (player == null)
|
||||||
|
{
|
||||||
teleportLocation = null;
|
teleportLocation = null;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
teleportLocation = here ? player.getLocation() : this.getLocation();
|
teleportLocation = here ? player.getLocation() : this.getLocation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -392,6 +395,14 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
|||||||
|
|
||||||
private BigDecimal _getMoney()
|
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())
|
if (ess.getPaymentMethod().hasMethod())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -414,6 +425,14 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
|||||||
@Override
|
@Override
|
||||||
public void setMoney(final BigDecimal value)
|
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())
|
if (ess.getPaymentMethod().hasMethod())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -436,6 +455,14 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
|||||||
|
|
||||||
public void updateMoneyCache(final BigDecimal value)
|
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)
|
if (ess.getPaymentMethod().hasMethod() && super.getMoney() != value)
|
||||||
{
|
{
|
||||||
super.setMoney(value);
|
super.setMoney(value);
|
||||||
@ -767,8 +794,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(String message) {
|
public void sendMessage(String message)
|
||||||
if (!message.isEmpty()) {
|
{
|
||||||
|
if (!message.isEmpty())
|
||||||
|
{
|
||||||
base.sendMessage(message);
|
base.sendMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user