mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-07 00:38:42 +01:00
Fixing top command skipping some of the entries
This commit is contained in:
parent
383bf5da2d
commit
07e97f50ae
@ -12,6 +12,7 @@ import com.gamingmesh.jobs.commands.Cmd;
|
|||||||
import com.gamingmesh.jobs.commands.JobCommand;
|
import com.gamingmesh.jobs.commands.JobCommand;
|
||||||
import com.gamingmesh.jobs.container.Job;
|
import com.gamingmesh.jobs.container.Job;
|
||||||
import com.gamingmesh.jobs.container.TopList;
|
import com.gamingmesh.jobs.container.TopList;
|
||||||
|
import com.gamingmesh.jobs.stuff.Debug;
|
||||||
import com.gamingmesh.jobs.stuff.PageInfo;
|
import com.gamingmesh.jobs.stuff.PageInfo;
|
||||||
|
|
||||||
public class top implements Cmd {
|
public class top implements Cmd {
|
||||||
@ -56,7 +57,7 @@ public class top implements Cmd {
|
|||||||
int workingIn = Jobs.getUsedSlots(job);
|
int workingIn = Jobs.getUsedSlots(job);
|
||||||
PageInfo pi = new PageInfo(Jobs.getGCManager().JobsTopAmount, workingIn, page);
|
PageInfo pi = new PageInfo(Jobs.getGCManager().JobsTopAmount, workingIn, page);
|
||||||
|
|
||||||
List<TopList> FullList = Jobs.getJobsDAO().toplist(job.getName(), pi.getStart() - 1);
|
List<TopList> FullList = Jobs.getJobsDAO().toplist(job.getName(), pi.getStart());
|
||||||
if (FullList.isEmpty()) {
|
if (FullList.isEmpty()) {
|
||||||
player.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfo"));
|
player.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfo"));
|
||||||
return true;
|
return true;
|
||||||
@ -64,32 +65,31 @@ public class top implements Cmd {
|
|||||||
|
|
||||||
player.sendMessage(Jobs.getLanguage().getMessage("command.top.help.info"));
|
player.sendMessage(Jobs.getLanguage().getMessage("command.top.help.info"));
|
||||||
|
|
||||||
|
int place = 1;
|
||||||
|
|
||||||
if (!Jobs.getGCManager().ShowToplistInScoreboard) {
|
if (!Jobs.getGCManager().ShowToplistInScoreboard) {
|
||||||
player.sendMessage(Jobs.getLanguage().getMessage("command.top.output.topline", "%jobname%", job.getName(), "%amount%", Jobs.getGCManager().JobsTopAmount));
|
player.sendMessage(Jobs.getLanguage().getMessage("command.top.output.topline", "%jobname%", job.getName(), "%amount%", Jobs.getGCManager().JobsTopAmount));
|
||||||
for (TopList One : FullList) {
|
for (TopList One : FullList) {
|
||||||
if (pi.isContinue())
|
if (place > Jobs.getGCManager().JobsTopAmount)
|
||||||
continue;
|
|
||||||
if (pi.isBreak())
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
player.sendMessage(Jobs.getLanguage().getMessage("command.top.output.list",
|
player.sendMessage(Jobs.getLanguage().getMessage("command.top.output.list",
|
||||||
"%number%", pi.getPositionForOutput(),
|
"%number%", ((page - 1) * Jobs.getGCManager().JobsTopAmount) + place,
|
||||||
"%playername%", One.getPlayerInfo().getName(),
|
"%playername%", One.getPlayerInfo().getName(),
|
||||||
"%level%", One.getLevel(),
|
"%level%", One.getLevel(),
|
||||||
"%exp%", One.getExp()));
|
"%exp%", One.getExp()));
|
||||||
|
place++;
|
||||||
}
|
}
|
||||||
Jobs.getInstance().ShowPagination(sender, pi, "jobs top " + job.getName());
|
Jobs.getInstance().ShowPagination(sender, pi, "jobs top " + job.getName());
|
||||||
} else {
|
} else {
|
||||||
List<String> ls = new ArrayList<>();
|
List<String> ls = new ArrayList<>();
|
||||||
|
|
||||||
for (TopList one : FullList) {
|
for (TopList one : FullList) {
|
||||||
if (pi.isContinue())
|
if (place > Jobs.getGCManager().JobsTopAmount)
|
||||||
continue;
|
|
||||||
if (pi.isBreak())
|
|
||||||
break;
|
break;
|
||||||
|
ls.add(Jobs.getLanguage().getMessage("scoreboard.line", "%number%", ((page - 1) * Jobs.getGCManager().JobsTopAmount) + place,
|
||||||
ls.add(Jobs.getLanguage().getMessage("scoreboard.line", "%number%", pi.getPositionForOutput(),
|
|
||||||
"%playername%", one.getPlayerInfo().getName(), "%level%", one.getLevel()));
|
"%playername%", one.getPlayerInfo().getName(), "%level%", one.getLevel()));
|
||||||
|
place++;
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getCMIScoreboardManager().setScoreBoard(player, Jobs.getLanguage().getMessage("scoreboard.topline", "%jobname%", job.getName()), ls);
|
plugin.getCMIScoreboardManager().setScoreBoard(player, Jobs.getLanguage().getMessage("scoreboard.topline", "%jobname%", job.getName()), ls);
|
||||||
|
Loading…
Reference in New Issue
Block a user