This commit is contained in:
mohammed jasem alaajel 2024-04-26 21:17:38 +04:00
parent b88202ae38
commit d0ae5d5342
1 changed files with 10 additions and 3 deletions

View File

@ -94,7 +94,7 @@ public class CommandRedisBungee extends AdventureBaseCommand {
private List<Map.Entry<String, Integer>> subListProxies(List<Map.Entry<String, Integer>> data, int currentPage, int pageSize) {
private List<Map.Entry<String, Integer>> subListProxies(List<Map.Entry<String, Integer>> data, final int currentPage, final int pageSize) {
return data.subList(((currentPage * pageSize) - pageSize), Ints.constrainToRange(currentPage * pageSize, 0, data.size()));
}
@ -123,6 +123,14 @@ public class CommandRedisBungee extends AdventureBaseCommand {
} else currentPage = 1;
var data = new ArrayList<>(plugin.proxyDataManager().eachProxyCount().entrySet());
data.addAll(data);
data.addAll(data);
data.addAll(data);
data.addAll(data);
data.addAll(data);
data.addAll(data);
data.addAll(data);
data.addAll(data);
// there is no way this runs because there is always an heartbeat.
// if not could be some shenanigans done by devs :P
@ -131,9 +139,8 @@ public class CommandRedisBungee extends AdventureBaseCommand {
return;
}
// compute the total pages
final int maxPages = (data.size() / pageSize);
int maxPages = data.size() < pageSize ? 1 : data.size() / pageSize ;
if (currentPage > maxPages) currentPage = maxPages;
var subList = subListProxies(data, currentPage, pageSize);
TextComponent.Builder builder = Component.text();
builder.append(MiniMessage.miniMessage().deserialize(closer)).appendNewline();