mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-02 14:29:07 +01:00
Centralizing auto pagination
This commit is contained in:
parent
8bdd49d988
commit
5c1321ecd4
@ -1471,50 +1471,6 @@ public final class Jobs extends JavaPlugin {
|
||||
|
||||
}
|
||||
|
||||
public void showPagination(CommandSender sender, PageInfo pi, String cmd) {
|
||||
showPagination(sender, pi.getTotalPages(), pi.getCurrentPage(), pi.getTotalEntries(), cmd, null);
|
||||
}
|
||||
|
||||
public void showPagination(CommandSender sender, PageInfo pi, String cmd, String pagePref) {
|
||||
showPagination(sender, pi.getTotalPages(), pi.getCurrentPage(), pi.getTotalEntries(), cmd, pagePref);
|
||||
}
|
||||
|
||||
public void showPagination(CommandSender sender, int pageCount, int currentPage, int totalEntries, String cmd, String pagePref) {
|
||||
if (!(sender instanceof Player))
|
||||
return;
|
||||
|
||||
if (!cmd.startsWith("/"))
|
||||
cmd = "/" + cmd;
|
||||
|
||||
if (pageCount == 1)
|
||||
return;
|
||||
|
||||
String pagePrefix = pagePref == null ? "" : pagePref;
|
||||
|
||||
int nextPage = currentPage + 1;
|
||||
nextPage = currentPage < pageCount ? nextPage : currentPage;
|
||||
|
||||
int prevpage = currentPage - 1;
|
||||
if (currentPage <= 1) {
|
||||
prevpage = currentPage;
|
||||
}
|
||||
|
||||
RawMessage rm = new RawMessage()
|
||||
.addText((currentPage > 1 ? LC.info_prevPage.getLocale() : LC.info_prevPageOff.getLocale()))
|
||||
.addHover(currentPage > 1 ? LC.info_prevPageHover.getLocale() : LC.info_lastPageHover.getLocale())
|
||||
.addCommand(currentPage > 1 ? cmd + " " + pagePrefix + prevpage : cmd + " " + pagePrefix + pageCount);
|
||||
|
||||
rm.addText(LC.info_pageCount.getLocale("[current]", currentPage, "[total]", pageCount))
|
||||
.addHover(LC.info_pageCountHover.getLocale("[totalEntries]", totalEntries));
|
||||
|
||||
rm.addText(pageCount > currentPage ? LC.info_nextPage.getLocale() : LC.info_nextPageOff.getLocale())
|
||||
.addHover(pageCount > currentPage ? LC.info_nextPageHover.getLocale() : LC.info_firstPageHover.getLocale())
|
||||
.addCommand(pageCount > currentPage ? cmd + " " + pagePrefix + nextPage : cmd + " " + pagePrefix + 1);
|
||||
|
||||
if (pageCount != 0)
|
||||
rm.show(sender);
|
||||
}
|
||||
|
||||
public static boolean hasLimitedItems() {
|
||||
return hasLimitedItems;
|
||||
}
|
||||
|
@ -14,6 +14,8 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.list.info;
|
||||
import com.gamingmesh.jobs.commands.list.playerinfo;
|
||||
import com.gamingmesh.jobs.container.ActionType;
|
||||
import com.gamingmesh.jobs.container.Boost;
|
||||
import com.gamingmesh.jobs.container.CurrencyType;
|
||||
@ -28,7 +30,6 @@ import net.Zrips.CMILib.ActionBar.CMIActionBar;
|
||||
import net.Zrips.CMILib.Container.CMIArray;
|
||||
import net.Zrips.CMILib.Container.PageInfo;
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.RawMessages.RawMessage;
|
||||
|
||||
@ -162,18 +163,12 @@ public class JobsCommands implements CommandExecutor {
|
||||
|
||||
boolean pl = sender instanceof Player;
|
||||
|
||||
// Old format
|
||||
// sender.sendMessage(Jobs.getLanguage().getMessage("command.help.output.title"));
|
||||
for (String one : commands) {
|
||||
if (!pi.isEntryOk())
|
||||
continue;
|
||||
if (pi.isBreak())
|
||||
break;
|
||||
|
||||
// Old format
|
||||
// sender.sendMessage(Jobs.getLanguage().getMessage("command.help.output.cmdInfoFormat", "[command]", getUsage(one), "[description]", Jobs.getLanguage().getMessage("command." + one
|
||||
// + ".help.info")));
|
||||
|
||||
if (pl) {
|
||||
rm.addText("\n" + getUsage(one));
|
||||
rm.addHover(Jobs.getLanguage().getMessage("command." + one + ".help.info"));
|
||||
@ -182,12 +177,10 @@ public class JobsCommands implements CommandExecutor {
|
||||
rm.addText("\n" + Jobs.getLanguage().getMessage("command.help.output.cmdInfoFormat", "[command]", getUsage(one), "[description]", Jobs.getLanguage().getMessage("command." + one
|
||||
+ ".help.info")));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
rm.show(sender);
|
||||
|
||||
plugin.showPagination(sender, pi, LABEL + " ?");
|
||||
pi.autoPagination(sender, LABEL + " ?");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -333,9 +326,9 @@ public class JobsCommands implements CommandExecutor {
|
||||
String pName = player.getName();
|
||||
|
||||
if (sender.getName().equalsIgnoreCase(pName))
|
||||
plugin.showPagination(sender, pi, "jobs info " + job.getName() + t);
|
||||
pi.autoPagination(sender, LABEL + " " + info.class.getSimpleName() + " " + job.getName() + t);
|
||||
else
|
||||
plugin.showPagination(sender, pi, "jobs playerinfo " + pName + " " + job.getName() + t);
|
||||
pi.autoPagination(sender, LABEL + " " + playerinfo.class.getSimpleName() + " " + job.getName() + t);
|
||||
}
|
||||
}
|
||||
|
||||
@ -356,11 +349,11 @@ public class JobsCommands implements CommandExecutor {
|
||||
message.append(":\n");
|
||||
|
||||
JobProgression prog = player.getJobProgression(job);
|
||||
|
||||
|
||||
if (prog == null) {
|
||||
prog = player.getArchivedJobProgression(job);
|
||||
}
|
||||
|
||||
prog = player.getArchivedJobProgression(job);
|
||||
}
|
||||
|
||||
int level = prog != null ? prog.getLevel() : 1;
|
||||
int numjobs = player.progression.size();
|
||||
|
||||
|
@ -113,7 +113,7 @@ public class browse implements Cmd {
|
||||
|
||||
rm.show(sender);
|
||||
}
|
||||
plugin.showPagination(sender, pi, "jobs browse", "-p:");
|
||||
pi.autoPagination(sender, "jobs browse", "-p:");
|
||||
} else {
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.jobHeader", "[jobname]", j.getName()));
|
||||
|
@ -117,7 +117,7 @@ public class editjobs implements Cmd {
|
||||
rm.show(sender);
|
||||
Util.getJobsEditorMap().remove(player.getUniqueId());
|
||||
|
||||
plugin.showPagination(sender, pi, "jobs editjobs list " + job.getName() + " " + actionT.getName());
|
||||
pi.autoPagination(sender, "jobs editjobs list " + job.getName() + " " + actionT.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -20,79 +20,79 @@ public class gtop implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
}
|
||||
if (!(sender instanceof Player)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length > 1) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "gtop");
|
||||
return true;
|
||||
}
|
||||
if (args.length > 1) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "gtop");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
int page = 1;
|
||||
if (args.length == 1) {
|
||||
if (args[0].equalsIgnoreCase("clear")) {
|
||||
player.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
|
||||
CMIScoreboard.removeScoreBoard(player);
|
||||
return true;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
int page = 1;
|
||||
if (args.length == 1) {
|
||||
if (args[0].equalsIgnoreCase("clear")) {
|
||||
player.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
|
||||
CMIScoreboard.removeScoreBoard(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
page = Integer.parseInt(args[0]);
|
||||
} catch (NumberFormatException e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
try {
|
||||
page = Integer.parseInt(args[0]);
|
||||
} catch (NumberFormatException e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (page < 1)
|
||||
page = 1;
|
||||
if (page < 1)
|
||||
page = 1;
|
||||
|
||||
int amount = Jobs.getGCManager().JobsTopAmount;
|
||||
PageInfo pi = new PageInfo(amount, Jobs.getPlayerManager().getPlayersCache().size(), page);
|
||||
int amount = Jobs.getGCManager().JobsTopAmount;
|
||||
PageInfo pi = new PageInfo(amount, Jobs.getPlayerManager().getPlayersCache().size(), page);
|
||||
|
||||
List<TopList> FullList = Jobs.getJobsDAO().getGlobalTopList(pi.getStart());
|
||||
if (FullList.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.gtop.error.nojob"));
|
||||
return true;
|
||||
}
|
||||
List<TopList> FullList = Jobs.getJobsDAO().getGlobalTopList(pi.getStart());
|
||||
if (FullList.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.gtop.error.nojob"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!Jobs.getGCManager().ShowToplistInScoreboard) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.gtop.output.topline", "%amount%", amount));
|
||||
if (!Jobs.getGCManager().ShowToplistInScoreboard) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.gtop.output.topline", "%amount%", amount));
|
||||
|
||||
int i = 0;
|
||||
for (TopList One : FullList) {
|
||||
if (i >= amount)
|
||||
break;
|
||||
int i = 0;
|
||||
for (TopList One : FullList) {
|
||||
if (i >= amount)
|
||||
break;
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.gtop.output.list",
|
||||
"%number%", pi.getPositionForOutput(i),
|
||||
"%playername%", One.getPlayerInfo().getName(),
|
||||
"%playerdisplayname%", One.getPlayerInfo().getDisplayName(),
|
||||
"%level%", One.getLevel(),
|
||||
"%exp%", One.getExp()));
|
||||
++i;
|
||||
}
|
||||
} else {
|
||||
List<String> ls = new ArrayList<>();
|
||||
int i = 0;
|
||||
for (TopList one : FullList) {
|
||||
if (i >= amount)
|
||||
break;
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.gtop.output.list",
|
||||
"%number%", pi.getPositionForOutput(i),
|
||||
"%playername%", One.getPlayerInfo().getName(),
|
||||
"%playerdisplayname%", One.getPlayerInfo().getDisplayName(),
|
||||
"%level%", One.getLevel(),
|
||||
"%exp%", One.getExp()));
|
||||
++i;
|
||||
}
|
||||
} else {
|
||||
List<String> ls = new ArrayList<>();
|
||||
int i = 0;
|
||||
for (TopList one : FullList) {
|
||||
if (i >= amount)
|
||||
break;
|
||||
|
||||
ls.add(Jobs.getLanguage().getMessage("scoreboard.line",
|
||||
"%number%", pi.getPositionForOutput(i),
|
||||
"%playername%", one.getPlayerInfo().getName(),
|
||||
"%playerdisplayname%", one.getPlayerInfo().getDisplayName(),
|
||||
"%level%", one.getLevel()));
|
||||
++i;
|
||||
}
|
||||
ls.add(Jobs.getLanguage().getMessage("scoreboard.line",
|
||||
"%number%", pi.getPositionForOutput(i),
|
||||
"%playername%", one.getPlayerInfo().getName(),
|
||||
"%playerdisplayname%", one.getPlayerInfo().getDisplayName(),
|
||||
"%level%", one.getLevel()));
|
||||
++i;
|
||||
}
|
||||
|
||||
CMIScoreboard.show(player, Jobs.getLanguage().getMessage("scoreboard.gtopline"), ls, Jobs.getGCManager().ToplistInScoreboardInterval);
|
||||
}
|
||||
CMIScoreboard.show(player, Jobs.getLanguage().getMessage("scoreboard.gtopline"), ls, Jobs.getGCManager().ToplistInScoreboardInterval);
|
||||
}
|
||||
|
||||
plugin.showPagination(sender, pi, "jobs gtop");
|
||||
return true;
|
||||
pi.autoPagination(sender, "jobs gtop");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -16,61 +16,61 @@ public class placeholders implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
boolean isPlayer = sender instanceof Player;
|
||||
Player player = isPlayer ? (Player) sender : null;
|
||||
boolean isPlayer = sender instanceof Player;
|
||||
Player player = isPlayer ? (Player) sender : null;
|
||||
|
||||
int page = 1;
|
||||
if (args.length > 0) {
|
||||
if (isPlayer) {
|
||||
if (args[0].startsWith("-p:")) {
|
||||
try {
|
||||
page = Integer.parseInt(args[0].substring("-p:".length()));
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
player = Bukkit.getPlayer(args[0]);
|
||||
if (player == null) {
|
||||
Jobs.consoleMsg("&cPlayer cannot be null!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
int page = 1;
|
||||
if (args.length > 0) {
|
||||
if (isPlayer) {
|
||||
if (args[0].startsWith("-p:")) {
|
||||
try {
|
||||
page = Integer.parseInt(args[0].substring("-p:".length()));
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
player = Bukkit.getPlayer(args[0]);
|
||||
if (player == null) {
|
||||
Jobs.consoleMsg("&cPlayer cannot be null!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length >= 2 && args[0].equalsIgnoreCase("parse")) {
|
||||
String placeholder = args[1];
|
||||
JobsPlaceholderType type = plugin.getPlaceholderAPIManager().getPlaceHolderType(player, placeholder);
|
||||
if (args.length >= 2 && args[0].equalsIgnoreCase("parse")) {
|
||||
String placeholder = args[1];
|
||||
JobsPlaceholderType type = plugin.getPlaceholderAPIManager().getPlaceHolderType(player, placeholder);
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.placeholders.output.parse",
|
||||
"[placeholder]", placeholder,
|
||||
"[source]", type == null ? "Unknown" : type.name(),
|
||||
"[result]", plugin.getPlaceholderAPIManager().updatePlaceHolders(player, placeholder)));
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.placeholders.output.parse",
|
||||
"[placeholder]", placeholder,
|
||||
"[source]", type == null ? "Unknown" : type.name(),
|
||||
"[result]", plugin.getPlaceholderAPIManager().updatePlaceHolders(player, placeholder)));
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
JobsPlaceHolders[] values = JobsPlaceHolders.values();
|
||||
PageInfo pi = new PageInfo(isPlayer ? Jobs.getGCManager().PlaceholdersPage : values.length, values.length, page);
|
||||
JobsPlaceHolders[] values = JobsPlaceHolders.values();
|
||||
PageInfo pi = new PageInfo(isPlayer ? Jobs.getGCManager().PlaceholdersPage : values.length, values.length, page);
|
||||
|
||||
for (JobsPlaceHolders one : values) {
|
||||
if (pi.isBreak())
|
||||
break;
|
||||
for (JobsPlaceHolders one : values) {
|
||||
if (pi.isBreak())
|
||||
break;
|
||||
|
||||
if (!pi.isEntryOk())
|
||||
continue;
|
||||
if (!pi.isEntryOk())
|
||||
continue;
|
||||
|
||||
RawMessage rm = new RawMessage();
|
||||
String extra = "";
|
||||
RawMessage rm = new RawMessage();
|
||||
String extra = "";
|
||||
|
||||
if (player != null && !one.isComplex())
|
||||
extra = plugin.getPlaceholderAPIManager().updatePlaceHolders(player, Jobs.getLanguage().getMessage("command.placeholders.output.outputResult",
|
||||
"[result]", plugin.getPlaceholderAPIManager().updatePlaceHolders(player, one.getFull())));
|
||||
if (player != null && !one.isComplex())
|
||||
extra = plugin.getPlaceholderAPIManager().updatePlaceHolders(player, Jobs.getLanguage().getMessage("command.placeholders.output.outputResult",
|
||||
"[result]", plugin.getPlaceholderAPIManager().updatePlaceHolders(player, one.getFull())));
|
||||
|
||||
String place = one.getFull();
|
||||
String hover = "";
|
||||
if (plugin.isPlaceholderAPIEnabled()) {
|
||||
hover = place = one.getFull();
|
||||
}
|
||||
String place = one.getFull();
|
||||
String hover = "";
|
||||
if (plugin.isPlaceholderAPIEnabled()) {
|
||||
hover = place = one.getFull();
|
||||
}
|
||||
// For MVdWPlaceholderAPI
|
||||
// if (plugin.isMVdWPlaceholderAPIEnabled()) {
|
||||
// if (!plugin.isPlaceholderAPIEnabled()) {
|
||||
@ -82,12 +82,12 @@ public class placeholders implements Cmd {
|
||||
// else
|
||||
// hover += "\n" + "{" + one.getFull().substring(1, one.getFull().length() - 2) + "}";
|
||||
// }
|
||||
rm.addText(Jobs.getLanguage().getMessage("command.placeholders.output.list", "[place]", pi.getPositionForOutput(), "[placeholder]", place) + extra)
|
||||
.addHover(hover).addSuggestion(one.getFull()).show(sender);
|
||||
}
|
||||
rm.addText(Jobs.getLanguage().getMessage("command.placeholders.output.list", "[place]", pi.getPositionForOutput(), "[placeholder]", place) + extra)
|
||||
.addHover(hover).addSuggestion(one.getFull()).show(sender);
|
||||
}
|
||||
|
||||
if (player != null)
|
||||
plugin.showPagination(sender, pi, "jobs placeholders", "-p:");
|
||||
return true;
|
||||
if (player != null)
|
||||
pi.autoPagination(sender, "jobs placeholders", "-p:");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -21,83 +21,83 @@ public class top implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
}
|
||||
if (!(sender instanceof Player)) {
|
||||
CMIMessages.sendMessage(sender, LC.info_Ingame);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length != 1 && args.length != 2) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "top");
|
||||
return false;
|
||||
}
|
||||
if (args.length != 1 && args.length != 2) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "top");
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
if (args[0].equalsIgnoreCase("clear")) {
|
||||
player.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
|
||||
CMIScoreboard.removeScoreBoard(player);
|
||||
return true;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
if (args[0].equalsIgnoreCase("clear")) {
|
||||
player.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
|
||||
CMIScoreboard.removeScoreBoard(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
int page = 1;
|
||||
if (args.length == 2) {
|
||||
try {
|
||||
page = Integer.parseInt(args[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (page < 1)
|
||||
page = 1;
|
||||
int page = 1;
|
||||
if (args.length == 2) {
|
||||
try {
|
||||
page = Integer.parseInt(args[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (page < 1)
|
||||
page = 1;
|
||||
|
||||
Job job = Jobs.getJob(args[0]);
|
||||
if (job == null) {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.top.error.nojob"));
|
||||
return false;
|
||||
}
|
||||
Job job = Jobs.getJob(args[0]);
|
||||
if (job == null) {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.top.error.nojob"));
|
||||
return false;
|
||||
}
|
||||
|
||||
int workingIn = Jobs.getUsedSlots(job);
|
||||
PageInfo pi = new PageInfo(Jobs.getGCManager().JobsTopAmount, workingIn, page);
|
||||
int workingIn = Jobs.getUsedSlots(job);
|
||||
PageInfo pi = new PageInfo(Jobs.getGCManager().JobsTopAmount, workingIn, page);
|
||||
|
||||
List<TopList> fullList = Jobs.getJobsDAO().toplist(job.getName(), pi.getStart());
|
||||
if (fullList.isEmpty()) {
|
||||
CMIMessages.sendMessage(sender, LC.info_NoInformation);
|
||||
return true;
|
||||
}
|
||||
List<TopList> fullList = Jobs.getJobsDAO().toplist(job.getName(), pi.getStart());
|
||||
if (fullList.isEmpty()) {
|
||||
CMIMessages.sendMessage(sender, LC.info_NoInformation);
|
||||
return true;
|
||||
}
|
||||
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.top.help.info"));
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.top.help.info"));
|
||||
|
||||
int place = 1;
|
||||
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 (place > Jobs.getGCManager().JobsTopAmount)
|
||||
break;
|
||||
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 (place > Jobs.getGCManager().JobsTopAmount)
|
||||
break;
|
||||
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.top.output.list",
|
||||
"%number%", ((page - 1) * Jobs.getGCManager().JobsTopAmount) + place,
|
||||
"%playername%", one.getPlayerInfo().getName(),
|
||||
"%playerdisplayname%", one.getPlayerInfo().getDisplayName(),
|
||||
"%level%", one.getLevel(),
|
||||
"%exp%", one.getExp()));
|
||||
place++;
|
||||
}
|
||||
plugin.showPagination(sender, pi, "jobs top " + job.getName());
|
||||
} else {
|
||||
List<String> ls = new ArrayList<>();
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.top.output.list",
|
||||
"%number%", ((page - 1) * Jobs.getGCManager().JobsTopAmount) + place,
|
||||
"%playername%", one.getPlayerInfo().getName(),
|
||||
"%playerdisplayname%", one.getPlayerInfo().getDisplayName(),
|
||||
"%level%", one.getLevel(),
|
||||
"%exp%", one.getExp()));
|
||||
place++;
|
||||
}
|
||||
pi.autoPagination(sender, "jobs top " + job.getName());
|
||||
} else {
|
||||
List<String> ls = new ArrayList<>();
|
||||
|
||||
for (TopList one : fullList) {
|
||||
if (place > Jobs.getGCManager().JobsTopAmount)
|
||||
break;
|
||||
ls.add(Jobs.getLanguage().getMessage("scoreboard.line", "%number%", ((page - 1) * Jobs.getGCManager().JobsTopAmount) + place,
|
||||
"%playername%", one.getPlayerInfo().getName(), "%playerdisplayname%", one.getPlayerInfo().getDisplayName(), "%level%", one.getLevel()));
|
||||
place++;
|
||||
}
|
||||
for (TopList one : fullList) {
|
||||
if (place > Jobs.getGCManager().JobsTopAmount)
|
||||
break;
|
||||
ls.add(Jobs.getLanguage().getMessage("scoreboard.line", "%number%", ((page - 1) * Jobs.getGCManager().JobsTopAmount) + place,
|
||||
"%playername%", one.getPlayerInfo().getName(), "%playerdisplayname%", one.getPlayerInfo().getDisplayName(), "%level%", one.getLevel()));
|
||||
place++;
|
||||
}
|
||||
|
||||
CMIScoreboard.show(player, Jobs.getLanguage().getMessage("scoreboard.topline", "%jobname%", job.getName()), ls, Jobs.getGCManager().ToplistInScoreboardInterval);
|
||||
CMIScoreboard.show(player, Jobs.getLanguage().getMessage("scoreboard.topline", "%jobname%", job.getName()), ls, Jobs.getGCManager().ToplistInScoreboardInterval);
|
||||
|
||||
plugin.showPagination(sender, pi, "jobs top " + job.getName());
|
||||
}
|
||||
return true;
|
||||
pi.autoPagination(sender, "jobs top " + job.getName());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user