From e6a128d876be490c9f16daefb8a70920e9739842 Mon Sep 17 00:00:00 2001 From: montlikadani Date: Sun, 26 Jan 2020 13:04:51 +0100 Subject: [PATCH] Added ability to change the colors of required jobs, levels --- .../jobs/config/LanguageManager.java | 5 ++++- .../gamingmesh/jobs/config/ShopManager.java | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java index b3ee543b..34b73bc2 100644 --- a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java @@ -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"); diff --git a/src/main/java/com/gamingmesh/jobs/config/ShopManager.java b/src/main/java/com/gamingmesh/jobs/config/ShopManager.java index 6b6874a3..c58eae54 100644 --- a/src/main/java/com/gamingmesh/jobs/config/ShopManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/ShopManager.java @@ -158,27 +158,32 @@ public class ShopManager { if (!item.getRequiredJobs().isEmpty()) { Lore.add(Jobs.getLanguage().getMessage("command.shop.info.reqJobs")); for (Entry 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);