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

Added ability to change the colors of required jobs, levels

This commit is contained in:
montlikadani 2020-01-26 13:04:51 +01:00
parent 643cfcbb0d
commit e6a128d876
2 changed files with 16 additions and 8 deletions

View File

@ -299,8 +299,11 @@ public class LanguageManager {
c.get("command.shop.info.currentPoints", "&eYou have: &6%currentpoints%");
c.get("command.shop.info.price", "&ePrice: &6%price%");
c.get("command.shop.info.reqJobs", "&eRequired jobs:");
c.get("command.shop.info.reqJobsList", " &6%jobsname%&e: &e%level% lvl");
c.get("command.shop.info.reqJobsList", " &e%jobsname%&e: &e%level% lvl");
c.get("command.shop.info.reqTotalLevel", "&6Required total level: &e%totalLevel%");
c.get("command.shop.info.reqJobsColor", "&4");
c.get("command.shop.info.reqJobsLevelColor", "&4");
c.get("command.shop.info.reqTotalLevelColor", "&4");
c.get("command.shop.info.cantOpen", "&cCan't open this page");
c.get("command.shop.info.NoPermForItem", "&cYou don't have required permissions for this item!");
c.get("command.shop.info.NoPermToBuy", "&cNo permissions to buy this item");

View File

@ -158,27 +158,32 @@ public class ShopManager {
if (!item.getRequiredJobs().isEmpty()) {
Lore.add(Jobs.getLanguage().getMessage("command.shop.info.reqJobs"));
for (Entry<String, Integer> one : item.getRequiredJobs().entrySet()) {
Job job = Jobs.getJob(one.getKey());
if (job == null) {
continue;
}
String jobColor = "";
String levelColor = "";
Job job = Jobs.getJob(one.getKey());
JobProgression prog = Jobs.getPlayerManager().getJobsPlayer(player).getJobProgression(job);
if (prog == null) {
jobColor = ChatColor.DARK_RED.toString();
levelColor = ChatColor.DARK_RED.toString();
jobColor = Jobs.getLanguage().getMessage("command.shop.info.reqJobsColor");
levelColor = Jobs.getLanguage().getMessage("command.shop.info.reqJobsLevelColor");
}
if (prog != null && prog.getLevel() < one.getValue())
levelColor = ChatColor.DARK_RED.toString();
levelColor = Jobs.getLanguage().getMessage("command.shop.info.reqJobsLevelColor");
Lore.add(Jobs.getLanguage().getMessage("command.shop.info.reqJobsList", "%jobsname%", jobColor + one.getKey(), "%level%", levelColor + one.getValue()));
Lore.add(Jobs.getLanguage().getMessage("command.shop.info.reqJobsList", "%jobsname%",
jobColor + one.getKey(), "%level%", levelColor + one.getValue()));
}
}
if (item.getRequiredTotalLevels() != -1) {
Lore.add(Jobs.getLanguage().getMessage("command.shop.info.reqTotalLevel",
"%totalLevel%", (Jobs.getPlayerManager().getJobsPlayer(player).getTotalLevels() < item.getRequiredTotalLevels() ? ChatColor.DARK_RED + "" : "") + item.getRequiredTotalLevels()));
"%totalLevel%", (Jobs.getPlayerManager().getJobsPlayer(player).getTotalLevels() < item.getRequiredTotalLevels()
? Jobs.getLanguage().getMessage("command.shop.info.reqTotalLevelColor") : "") + item.getRequiredTotalLevels()));
}
meta.setLore(Lore);