Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ private void calculateBalanceTopMap() {
}
final LinkedHashMap<UUID, Entry> sortedMap = new LinkedHashMap<>();
entries.sort((entry1, entry2) -> entry2.getBalance().compareTo(entry1.getBalance()));
for (Entry entry : entries) {
final int entryLimit = ess.getSettings().getBaltopEntryLimit();
final int limit = entryLimit == -1 ? entries.size() : Math.min(entryLimit, entries.size());
for (int i = 0; i < limit; i++) {
final Entry entry = entries.get(i);
sortedMap.put(entry.getUuid(), entry);
}
topCache = sortedMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,8 @@ public interface ISettings extends IConf {

long getBaltopMinPlaytime();

int getBaltopEntryLimit();

enum KeepInvPolicy {
KEEP,
DELETE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2231,6 +2231,11 @@ public BigDecimal getBaltopMinBalance() {
return config.getBigDecimal("baltop-requirements.minimum-balance", BigDecimal.ZERO);
}

@Override
public int getBaltopEntryLimit() {
return config.getInt("baltop-entry-limit", -1);
}

@Override
public long getBaltopMinPlaytime() {
return config.getLong("baltop-requirements.minimum-playtime", 0);
Expand Down
5 changes: 5 additions & 0 deletions Essentials/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,11 @@ baltop-requirements:
minimum-balance: 0
minimum-playtime: 0

# Allows to limit cached balance top (/baltop) entries. This is especially recommended if
# you have a large number of players, then only a certain number of entries will be stored
# in the server's memory. Set to -1 to disable the limit
baltop-entry-limit: -1

# The format of currency, excluding symbols. For symbol configuration, see 'currency-symbol-format-locale' below.
#
# "#,##0.00" is how the majority of countries display currency.
Expand Down
Loading