mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-16 21:21:20 +01:00
Cleaner help page with click command suggestion
This commit is contained in:
parent
5856f9f483
commit
5d155f257c
@ -128,12 +128,17 @@ public class JobsCommands implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
PageInfo pi = new PageInfo(7, commands.size(), page);
|
||||
PageInfo pi = new PageInfo(10, commands.size(), page);
|
||||
if (page > pi.getTotalPages()) {
|
||||
CMIActionBar.send(sender, Jobs.getLanguage().getMessage("general.error.noHelpPage"));
|
||||
return true;
|
||||
}
|
||||
|
||||
RawMessage rm = new RawMessage();
|
||||
rm.addText(Jobs.getLanguage().getMessage("command.help.output.title"));
|
||||
|
||||
boolean pl = sender instanceof Player;
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.help.output.title"));
|
||||
for (String one : commands) {
|
||||
if (!pi.isEntryOk())
|
||||
@ -141,10 +146,23 @@ public class JobsCommands implements CommandExecutor {
|
||||
if (pi.isBreak())
|
||||
break;
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.help.output.cmdInfoFormat", "[command]", getUsage(one), "[description]", Jobs.getLanguage().getMessage("command." + one
|
||||
+ ".help.info")));
|
||||
// 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"));
|
||||
rm.addSuggestion("/" + Jobs.getLanguage().getMessage("command.help.output.label").toLowerCase() + " " + one + " ");
|
||||
} else {
|
||||
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 + " ?");
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user