From 804933a294abaf0aa0175ee0897f1a4c669b3dd4 Mon Sep 17 00:00:00 2001 From: montlikadani Date: Fri, 12 Oct 2018 15:59:56 +0200 Subject: [PATCH] Fixed /jobs browse not works in console - Some changes in version checking message - CROPS changed to WHEAT for default (No version update in plugin.yml because of the check) --- .../gamingmesh/jobs/commands/list/browse.java | 55 ++++++++++++++----- .../jobs/config/LanguageManager.java | 1 + .../gamingmesh/jobs/stuff/VersionChecker.java | 12 ++-- src/main/resources/jobConfig.yml | 4 +- src/main/resources/locale/messages_hu.yml | 7 ++- 5 files changed, 55 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/browse.java b/src/main/java/com/gamingmesh/jobs/commands/list/browse.java index 694d7838..3260c8c3 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/browse.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/browse.java @@ -82,9 +82,9 @@ public class browse implements Cmd { String hoverMsg = ""; - if (!one.getDescription().isEmpty()) { + if (!one.getDescription().isEmpty()) hoverMsg += one.getDescription().replace("/n", ""); - } + if (one.getMaxLevel(sender) > 0) { if (!hoverMsg.isEmpty()) hoverMsg += " \n"; @@ -121,15 +121,12 @@ public class browse implements Cmd { sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.jobHeader", "[jobname]", j.getName())); - if (j.getMaxLevel(sender) > 0) { + if (j.getMaxLevel(sender) > 0) sender.sendMessage(Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", j.getMaxLevel(sender))); - } - if (Jobs.getGCManager().ShowTotalWorkers) { + if (Jobs.getGCManager().ShowTotalWorkers) sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers())); - } - if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) { if ((int) (j.getBonus() * 100) < 0) sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (j.getBonus() * 100) * -1)); @@ -157,19 +154,51 @@ public class browse implements Cmd { } else { if (j == null) { sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.newHeader", "[amount]", jobList.size())); - } else { + for (Job one : jobList) { + + String msg = ""; + + if (!one.getDescription().isEmpty()) + msg += one.getDescription().replace("/n", ""); + + if (one.getMaxLevel(sender) > 0) { + if (!msg.isEmpty()) + msg += " \n"; + msg += Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", one.getMaxLevel(sender)); + } + + if (Jobs.getGCManager().ShowTotalWorkers) { + if (!msg.isEmpty()) + msg += " \n"; + msg += Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", one.getTotalPlayers()); + + } + + if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) { + if (!msg.isEmpty()) + msg += " \n"; + if ((int) (one.getBonus() * 100) < 0) + msg += Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (one.getBonus() * 100) * -1); + else + msg += Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (one.getBonus() * 100)); + } + + if (!msg.isEmpty()) + msg += " \n"; + msg += Jobs.getLanguage().getMessage("command.browse.output.consoleList", "[jobname]", one.getName()); + + sender.sendMessage(msg); + } + } else { sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.jobHeader", "[jobname]", j.getName())); - if (j.getMaxLevel(sender) > 0) { + if (j.getMaxLevel(sender) > 0) sender.sendMessage(Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", j.getMaxLevel(sender))); - } - if (Jobs.getGCManager().ShowTotalWorkers) { + if (Jobs.getGCManager().ShowTotalWorkers) sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers())); - } - if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) { if ((int) (j.getBonus() * 100) < 0) sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (j.getBonus() * 100) * -1)); diff --git a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java index 38f974f6..c4ac735f 100644 --- a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java @@ -432,6 +432,7 @@ public class LanguageManager { 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.consoleList", " &6[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"); diff --git a/src/main/java/com/gamingmesh/jobs/stuff/VersionChecker.java b/src/main/java/com/gamingmesh/jobs/stuff/VersionChecker.java index e1561b8e..8e1d97d1 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/VersionChecker.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/VersionChecker.java @@ -8,7 +8,6 @@ import java.util.Arrays; import java.util.List; import org.bukkit.Bukkit; -import org.bukkit.ChatColor; import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; @@ -135,13 +134,14 @@ public class VersionChecker { if (newVersion == null || newVersion.equalsIgnoreCase(currentVersion)) return; List msg = Arrays.asList( - ChatColor.GREEN + "*********************** " + plugin.getDescription().getName() + " **************************", - ChatColor.GREEN + "* " + newVersion + " is now available! Your version: " + currentVersion, - ChatColor.GREEN + "* " + ChatColor.DARK_GREEN + plugin.getDescription().getWebsite(), - ChatColor.GREEN + "************************************************************"); + "&a*********************** &e" + plugin.getDescription().getName() + "&a **************************", + "&a* &e" + newVersion + " is now available! Your version: &e" + currentVersion, + "&a* &2" + plugin.getDescription().getWebsite(), + "&a* Or get the dev. builds from &2https://github.com/Zrips/Jobs/releases", + "&a************************************************************"); for (String one : msg) if (player != null) - player.sendMessage(one); + player.sendMessage(org.bukkit.ChatColor.translateAlternateColorCodes('&', one)); } }); } diff --git a/src/main/resources/jobConfig.yml b/src/main/resources/jobConfig.yml index abe843b3..01416548 100644 --- a/src/main/resources/jobConfig.yml +++ b/src/main/resources/jobConfig.yml @@ -1287,7 +1287,7 @@ Jobs: income: 1.5 points: 1.5 experience: 3.0 - CROPS-7: + WHEAT-7: income: 1.5 points: 1.5 experience: 3.0 @@ -1348,7 +1348,7 @@ Jobs: points: 1 experience: 1.0 Place: - CROPS-0: + WHEAT-0: income: 3.0 points: 3 experience: 3.0 diff --git a/src/main/resources/locale/messages_hu.yml b/src/main/resources/locale/messages_hu.yml index a4d88e39..a3c2740f 100644 --- a/src/main/resources/locale/messages_hu.yml +++ b/src/main/resources/locale/messages_hu.yml @@ -282,7 +282,7 @@ command: info: '&eBarkácsol' none: '%jobname% nem kap pénzt, ha barkácsol.' drink: - info: '&eMegiszik' + info: '&eMegisz' none: '%jobname% nem kap pénzt, ha iszik.' smelt: info: '&eOlvaszt' @@ -330,7 +330,7 @@ command: args: '[munkanév]' error: alreadyin: '&cMár csatlakoztál a(z) %jobname%&c munkához!' - fullslots: '&cNem tudsz csatlakozni a(z) %jobname% munkához, mert nincsenek rendelkezésre álló helyek.' + fullslots: '&cNem tudsz csatlakozni a(z) %jobname%&c munkához, mert nincsenek rendelkezésre álló helyek.' maxjobs: '&cMár túl sok munkát vállaltál.' rejoin: '&cNem csatlakozhatsz ebbe a munkába. Várj [time]' rejoin: '&aKattints ide, hogy újra csatlakozz ebbe a munkába: ' @@ -366,6 +366,7 @@ command: bonus: ' &2Bónusz: &a[amount]%' newHeader: '&2========== [amount] ELÉRHETŐ MUNKÁK =========' list: ' &8[place]. &7[jobname]' + consoleList: ' &6[jobname]' click: '&bTovábbi információkért kattints a munkára!' detailed: '&bKattints ide a munka részleteinek mutatásához.' jobHeader: '&2========== [jobname] =========' @@ -415,7 +416,7 @@ command: error: alreadyin: '&cA játékos már dolgozik %jobname% munkánál.' output: - target: 'Most már a(z) %jobname% munkánál dolgozik.' + target: '&aMost már a(z) %jobname%&a munkánál dolgozik.' top: help: info: 'Top %amount% játékosok a ranglistán.'