From 07e97f50ae79d076b9b2adfc9d467839ee402a87 Mon Sep 17 00:00:00 2001 From: Zrips Date: Fri, 30 Oct 2020 12:26:04 +0200 Subject: [PATCH] Fixing top command skipping some of the entries --- .../gamingmesh/jobs/commands/list/top.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/top.java b/src/main/java/com/gamingmesh/jobs/commands/list/top.java index 3404541e..f6571896 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/top.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/top.java @@ -12,6 +12,7 @@ import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.TopList; +import com.gamingmesh.jobs.stuff.Debug; import com.gamingmesh.jobs.stuff.PageInfo; public class top implements Cmd { @@ -56,7 +57,7 @@ public class top implements Cmd { int workingIn = Jobs.getUsedSlots(job); PageInfo pi = new PageInfo(Jobs.getGCManager().JobsTopAmount, workingIn, page); - List FullList = Jobs.getJobsDAO().toplist(job.getName(), pi.getStart() - 1); + List FullList = Jobs.getJobsDAO().toplist(job.getName(), pi.getStart()); if (FullList.isEmpty()) { player.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfo")); return true; @@ -64,32 +65,31 @@ public class top implements Cmd { player.sendMessage(Jobs.getLanguage().getMessage("command.top.help.info")); + int place = 1; + if (!Jobs.getGCManager().ShowToplistInScoreboard) { player.sendMessage(Jobs.getLanguage().getMessage("command.top.output.topline", "%jobname%", job.getName(), "%amount%", Jobs.getGCManager().JobsTopAmount)); for (TopList One : FullList) { - if (pi.isContinue()) - continue; - if (pi.isBreak()) + if (place > Jobs.getGCManager().JobsTopAmount) break; player.sendMessage(Jobs.getLanguage().getMessage("command.top.output.list", - "%number%", pi.getPositionForOutput(), + "%number%", ((page - 1) * Jobs.getGCManager().JobsTopAmount) + place, "%playername%", One.getPlayerInfo().getName(), "%level%", One.getLevel(), "%exp%", One.getExp())); + place++; } Jobs.getInstance().ShowPagination(sender, pi, "jobs top " + job.getName()); } else { List ls = new ArrayList<>(); for (TopList one : FullList) { - if (pi.isContinue()) - continue; - if (pi.isBreak()) + if (place > Jobs.getGCManager().JobsTopAmount) break; - - ls.add(Jobs.getLanguage().getMessage("scoreboard.line", "%number%", pi.getPositionForOutput(), + ls.add(Jobs.getLanguage().getMessage("scoreboard.line", "%number%", ((page - 1) * Jobs.getGCManager().JobsTopAmount) + place, "%playername%", one.getPlayerInfo().getName(), "%level%", one.getLevel())); + place++; } plugin.getCMIScoreboardManager().setScoreBoard(player, Jobs.getLanguage().getMessage("scoreboard.topline", "%jobname%", job.getName()), ls);