1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-26 04:25:15 +01:00

help page new format and full customization option

This commit is contained in:
Zrips 2018-01-21 14:48:42 +02:00
parent 4d15d26b73
commit 7cebc15fe9
2 changed files with 35 additions and 45 deletions

View File

@ -132,37 +132,21 @@ public class JobsCommands implements CommandExecutor {
}
private static String getUsage(String cmd) {
StringBuilder builder = new StringBuilder();
builder.append(ChatColor.GREEN.toString());
builder.append('/').append(label).append(' ');
builder.append(cmd);
builder.append(ChatColor.YELLOW);
String cmdString = Jobs.getLanguage().getMessage("command.help.output.cmdFormat", "[command]", label + " " + cmd);
String key = "command." + cmd + ".help.args";
if (Jobs.getLanguage().containsKey(key)) {
builder.append(' ');
builder.append(Jobs.getLanguage().getMessage(key));
}
return builder.toString();
}
public static String getUsageNoCmd(String cmd) {
StringBuilder builder = new StringBuilder();
builder.append(ChatColor.GREEN.toString());
builder.append('/').append(label).append(' ');
builder.append(ChatColor.YELLOW);
String key = "command." + cmd + ".help.args";
if (Jobs.getLanguage().containsKey(key)) {
builder.append(' ');
builder.append(Jobs.getLanguage().getMessage(key));
}
return builder.toString();
if (Jobs.getLanguage().containsKey(key) && !Jobs.getLanguage().getMessage(key).isEmpty()) {
cmdString = cmdString.replace("[arguments]", " " + Jobs.getLanguage().getMessage(key));
} else {
cmdString = cmdString.replace("[arguments]", "");
}
return cmdString;
}
public void sendUsage(CommandSender sender, String cmd) {
String message = ChatColor.YELLOW + Jobs.getLanguage().getMessage("command.help.output.usage");
message = message.replace("%usage%", getUsage(cmd));
String message = Jobs.getLanguage().getMessage("command.help.output.cmdUsage");
message = message.replace("[command]", getUsage(cmd));
sender.sendMessage(message);
sender.sendMessage(ChatColor.YELLOW + "* " + Jobs.getLanguage().getMessage("command." + cmd + ".help.info"));
sender.sendMessage(Jobs.getLanguage().getMessage("command.help.output.helpPageDescription", "[description]", Jobs.getLanguage().getMessage("command." + cmd + ".help.info")));
}
protected boolean help(CommandSender sender, int page) {
@ -188,7 +172,10 @@ public class JobsCommands implements CommandExecutor {
continue;
if (pi.isBreak())
break;
sender.sendMessage(getUsage(one.getKey()) + " - " + Jobs.getLanguage().getMessage("command." + one.getKey() + ".help.info"));
String msg = Jobs.getLanguage().getMessage("command.help.output.cmdInfoFormat", "[command]", getUsage(one.getKey()), "[description]", Jobs.getLanguage().getMessage("command." + one.getKey()
+ ".help.info"));
sender.sendMessage(msg);
}
plugin.ShowPagination(sender, pi.getTotalPages(), page, label + " ?");

View File

@ -140,6 +140,25 @@ public class LanguageManager {
c.get("general.error.fromconsole", "&cYou can use this command only from console!");
c.get("general.error.worldisdisabled", "&cYou cant use command in this world!");
c.get("command.help.output.info", "Type /jobs [cmd] ? for more information about a command.");
c.get("command.help.output.cmdUsage", "&2Usage: &7[command]");
c.get("command.help.output.cmdInfoFormat", "[command] &f- &8[description]");
c.get("command.help.output.cmdFormat", "&7/[command]&f[arguments]");
c.get("command.help.output.helpPageDescription", "&2* [description]");
c.get("command.help.output.title", "&e-------&e ======= &6Jobs &e======= &e-------");
c.get("command.help.output.page", "&e-----&e ====== Page &6[1] &eof &6[2] &e====== &e-----");
c.get("command.help.output.fliperSimbols", "&e----------");
c.get("command.help.output.prevPage", "&2----<< &6Prev ");
c.get("command.help.output.prevPageOff", "&7----<< Prev ");
c.get("command.help.output.nextPage", "&6 Next &2>>----");
c.get("command.help.output.nextPageOff", "&7 Next >>----");
c.get("command.help.output.pageCount", "&2[current]/[total]");
c.get("command.moneyboost.help.info", "Boosts Money gain for all players");
c.get("command.moneyboost.help.args", "[jobname] [rate]");
Jobs.getGCManager().commandArgs.put("moneyboost", Arrays.asList("[jobname]", "[rate]"));
@ -209,18 +228,6 @@ public class LanguageManager {
c.get("command.resetlimit.help.args", "[playername]");
c.get("command.resetlimit.output.reseted", "&ePayment limits have been reset for: &2%playername%");
c.get("command.help.output.info", "Type /jobs [cmd] ? for more information about a command.");
c.get("command.help.output.usage", "Usage: %usage%");
c.get("command.help.output.title", "&e-------&e ======= &6Jobs &e======= &e-------");
c.get("command.help.output.page", "&e-----&e ====== Page &6[1] &eof &6[2] &e====== &e-----");
c.get("command.help.output.fliperSimbols", "&e----------");
c.get("command.help.output.prevPage", "&2----<< &6Prev ");
c.get("command.help.output.prevPageOff", "&7----<< Prev ");
c.get("command.help.output.nextPage", "&6 Next &2>>----");
c.get("command.help.output.nextPageOff", "&7 Next >>----");
c.get("command.help.output.pageCount", "&2[current]/[total]");
c.get("command.points.help.info", "Shows how much points player have.");
c.get("command.points.help.args", "[playername]");
Jobs.getGCManager().commandArgs.put("points", Arrays.asList("[playername]"));
@ -396,7 +403,7 @@ public class LanguageManager {
c.get("command.leaveall.help.info", "Leave all your jobs.");
c.get("command.leaveall.error.nojobs", "You do not have any jobs to leave!");
c.get("command.leaveall.success", "You have left all your jobs.");
c.get("command.explored.help.info", "Check who visited this chunk");
c.get("command.explored.error.noexplore", "No one visited this chunk");
c.get("command.explored.list", "&e%place%. %playername%");
@ -408,17 +415,15 @@ public class LanguageManager {
c.get("command.browse.output.totalWorkers", " &7Workers: &e[amount]");
c.get("command.browse.output.penalty", " &4Penalty: &c[amount]%");
c.get("command.browse.output.bonus", " &2Bonus: &a[amount]%");
c.get("command.browse.output.newHeader", "&2========== [amount] Available Jobs =========");
c.get("command.browse.output.list", " &8[place]. &7[jobname]");
c.get("command.browse.output.click", "&bClick on the job to see more info about it!");
c.get("command.browse.output.detailed", "&bClick to see more detailed list on job actions");
c.get("command.browse.output.detailed", "&bClick to see more detailed list on job actions");
c.get("command.browse.output.jobHeader", "&2========== [jobname] =========");
c.get("command.browse.output.chooseJob", "&7&n&oChoose this job");
c.get("command.browse.output.chooseJobHover", "&7Click here to get this job");
c.get("command.quests.help.info", "List available quests");
c.get("command.quests.help.args", "(playername)");
@ -427,8 +432,6 @@ public class LanguageManager {
c.get("command.quests.output.completed", "&2 !Completed!&r ");
c.get("command.quests.output.questLine", "[progress] &7[questName] &f[done]&7/&8[required]");
c.get("command.quests.output.hover", Arrays.asList("&f[jobName]", "[desc]", "&7New quest in: [time]"));
c.get("command.fire.help.info", "Fire the player from the job.");
c.get("command.fire.help.args", "[playername] [jobname]");