mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 14:05:25 +01:00
help page new format and full customization option
This commit is contained in:
parent
4d15d26b73
commit
7cebc15fe9
@ -132,37 +132,21 @@ public class JobsCommands implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String getUsage(String cmd) {
|
private static String getUsage(String cmd) {
|
||||||
StringBuilder builder = new StringBuilder();
|
String cmdString = Jobs.getLanguage().getMessage("command.help.output.cmdFormat", "[command]", label + " " + cmd);
|
||||||
builder.append(ChatColor.GREEN.toString());
|
|
||||||
builder.append('/').append(label).append(' ');
|
|
||||||
builder.append(cmd);
|
|
||||||
builder.append(ChatColor.YELLOW);
|
|
||||||
String key = "command." + cmd + ".help.args";
|
String key = "command." + cmd + ".help.args";
|
||||||
if (Jobs.getLanguage().containsKey(key)) {
|
if (Jobs.getLanguage().containsKey(key) && !Jobs.getLanguage().getMessage(key).isEmpty()) {
|
||||||
builder.append(' ');
|
cmdString = cmdString.replace("[arguments]", " " + Jobs.getLanguage().getMessage(key));
|
||||||
builder.append(Jobs.getLanguage().getMessage(key));
|
} else {
|
||||||
|
cmdString = cmdString.replace("[arguments]", "");
|
||||||
}
|
}
|
||||||
return builder.toString();
|
return cmdString;
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendUsage(CommandSender sender, String cmd) {
|
public void sendUsage(CommandSender sender, String cmd) {
|
||||||
String message = ChatColor.YELLOW + Jobs.getLanguage().getMessage("command.help.output.usage");
|
String message = Jobs.getLanguage().getMessage("command.help.output.cmdUsage");
|
||||||
message = message.replace("%usage%", getUsage(cmd));
|
message = message.replace("[command]", getUsage(cmd));
|
||||||
sender.sendMessage(message);
|
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) {
|
protected boolean help(CommandSender sender, int page) {
|
||||||
@ -188,7 +172,10 @@ public class JobsCommands implements CommandExecutor {
|
|||||||
continue;
|
continue;
|
||||||
if (pi.isBreak())
|
if (pi.isBreak())
|
||||||
break;
|
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 + " ?");
|
plugin.ShowPagination(sender, pi.getTotalPages(), page, label + " ?");
|
||||||
|
@ -140,6 +140,25 @@ public class LanguageManager {
|
|||||||
c.get("general.error.fromconsole", "&cYou can use this command only from console!");
|
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("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.info", "Boosts Money gain for all players");
|
||||||
c.get("command.moneyboost.help.args", "[jobname] [rate]");
|
c.get("command.moneyboost.help.args", "[jobname] [rate]");
|
||||||
Jobs.getGCManager().commandArgs.put("moneyboost", Arrays.asList("[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.help.args", "[playername]");
|
||||||
c.get("command.resetlimit.output.reseted", "&ePayment limits have been reset for: &2%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.info", "Shows how much points player have.");
|
||||||
c.get("command.points.help.args", "[playername]");
|
c.get("command.points.help.args", "[playername]");
|
||||||
Jobs.getGCManager().commandArgs.put("points", Arrays.asList("[playername]"));
|
Jobs.getGCManager().commandArgs.put("points", Arrays.asList("[playername]"));
|
||||||
@ -409,7 +416,6 @@ public class LanguageManager {
|
|||||||
c.get("command.browse.output.penalty", " &4Penalty: &c[amount]%");
|
c.get("command.browse.output.penalty", " &4Penalty: &c[amount]%");
|
||||||
c.get("command.browse.output.bonus", " &2Bonus: &a[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.newHeader", "&2========== [amount] Available Jobs =========");
|
||||||
c.get("command.browse.output.list", " &8[place]. &7[jobname]");
|
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.click", "&bClick on the job to see more info about it!");
|
||||||
@ -419,7 +425,6 @@ public class LanguageManager {
|
|||||||
c.get("command.browse.output.chooseJob", "&7&n&oChoose this job");
|
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.browse.output.chooseJobHover", "&7Click here to get this job");
|
||||||
|
|
||||||
|
|
||||||
c.get("command.quests.help.info", "List available quests");
|
c.get("command.quests.help.info", "List available quests");
|
||||||
c.get("command.quests.help.args", "(playername)");
|
c.get("command.quests.help.args", "(playername)");
|
||||||
c.get("command.quests.error.noquests", "There are no jobs you can join.");
|
c.get("command.quests.error.noquests", "There are no jobs you can join.");
|
||||||
@ -428,8 +433,6 @@ public class LanguageManager {
|
|||||||
c.get("command.quests.output.questLine", "[progress] &7[questName] &f[done]&7/&8[required]");
|
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.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.info", "Fire the player from the job.");
|
||||||
c.get("command.fire.help.args", "[playername] [jobname]");
|
c.get("command.fire.help.args", "[playername] [jobname]");
|
||||||
Jobs.getGCManager().commandArgs.put("fire", Arrays.asList("[playername]", "[oldjob]"));
|
Jobs.getGCManager().commandArgs.put("fire", Arrays.asList("[playername]", "[oldjob]"));
|
||||||
|
Loading…
Reference in New Issue
Block a user