2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2025-04-20 01:27:07 +00:00

fix pages again.....

This commit is contained in:
mohammed jasem alaajel 2024-04-28 15:17:11 +04:00
parent 294a8a5031
commit 089c5d8e5f
Signed by: ham1255
GPG Key ID: EF343502046229F4

View File

@ -134,7 +134,6 @@ public class CommandRedisBungee extends AdventureBaseCommand {
} else currentPage = 1; } else currentPage = 1;
var data = new ArrayList<>(plugin.proxyDataManager().eachProxyCount().entrySet()); var data = new ArrayList<>(plugin.proxyDataManager().eachProxyCount().entrySet());
// there is no way this runs because there is always an heartbeat. // there is no way this runs because there is always an heartbeat.
// if not could be some shenanigans done by devs :P // if not could be some shenanigans done by devs :P
if (data.isEmpty()) { if (data.isEmpty()) {
@ -142,7 +141,7 @@ public class CommandRedisBungee extends AdventureBaseCommand {
return; return;
} }
// compute the total pages // compute the total pages
int maxPages = data.size() < pageSize ? 1 : data.size() / pageSize ; int maxPages = (int) Math.ceil(data.size() / (double) pageSize);
if (currentPage > maxPages) currentPage = maxPages; if (currentPage > maxPages) currentPage = maxPages;
var subList = subListProxies(data, currentPage, pageSize); var subList = subListProxies(data, currentPage, pageSize);
TextComponent.Builder builder = Component.text(); TextComponent.Builder builder = Component.text();