mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 17:18:37 +01:00
Add option to hide balances <=0 from baltop (#4226)
Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
This commit is contained in:
parent
fa87c74b56
commit
6e5a41a880
@ -379,6 +379,8 @@ public interface ISettings extends IConf {
|
||||
|
||||
boolean isUpdateCheckEnabled();
|
||||
|
||||
boolean showZeroBaltop();
|
||||
|
||||
enum KeepInvPolicy {
|
||||
KEEP,
|
||||
DELETE,
|
||||
|
@ -1858,4 +1858,9 @@ public class Settings implements net.ess3.api.ISettings {
|
||||
public boolean isUpdateCheckEnabled() {
|
||||
return config.getBoolean("update-check", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showZeroBaltop() {
|
||||
return config.getBoolean("show-zero-baltop", true);
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import com.google.common.collect.Lists;
|
||||
import net.essentialsx.api.v2.services.BalanceTop;
|
||||
import org.bukkit.Server;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
@ -103,7 +104,9 @@ public class Commandbalancetop extends EssentialsCommand {
|
||||
newCache.getLines().add(tl("serverTotal", NumberUtil.displayCurrency(ess.getBalanceTop().getBalanceTopTotal(), ess)));
|
||||
int pos = 1;
|
||||
for (final Map.Entry<UUID, BalanceTop.Entry> entry : ess.getBalanceTop().getBalanceTopCache().entrySet()) {
|
||||
newCache.getLines().add(tl("balanceTopLine", pos, entry.getValue().getDisplayName(), NumberUtil.displayCurrency(entry.getValue().getBalance(), ess)));
|
||||
if (ess.getSettings().showZeroBaltop() || entry.getValue().getBalance().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
newCache.getLines().add(tl("balanceTopLine", pos, entry.getValue().getDisplayName(), NumberUtil.displayCurrency(entry.getValue().getBalance(), ess)));
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
cache = newCache;
|
||||
|
@ -781,6 +781,11 @@ minimum-pay-amount: 0.001
|
||||
# Enable this to block users who try to /pay another user which ignore them.
|
||||
pay-excludes-ignore-list: false
|
||||
|
||||
# Whether or not users with a balance less than or equal to $0 should be shown in balance-top.
|
||||
# Setting to false will not show people with balances <= 0 in balance-top.
|
||||
# NOTE: After reloading the config, you must also run '/baltop force' for this to appear
|
||||
show-zero-baltop: true
|
||||
|
||||
# The format of currency, excluding symbols. See currency-symbol-format-locale for symbol configuration.
|
||||
#
|
||||
# "#,##0.00" is how the majority of countries display currency.
|
||||
|
Loading…
Reference in New Issue
Block a user