diff --git a/src/main/java/com/gamingmesh/jobs/PlayerManager.java b/src/main/java/com/gamingmesh/jobs/PlayerManager.java index 1a0630c7..dc9e2f1e 100644 --- a/src/main/java/com/gamingmesh/jobs/PlayerManager.java +++ b/src/main/java/com/gamingmesh/jobs/PlayerManager.java @@ -658,7 +658,8 @@ public class PlayerManager { String message = Jobs.getLanguage().getMessage("message.leveldown.message"); message = message.replace("%jobname%", job.getDisplayName()); - message = message.replace("%playername%", player != null ? plugin.getComplement().getDisplayName(player) : jPlayer.getName()); + message = message.replace("%playername%", jPlayer.getName()); + message = message.replace("%playerdisplayname%", jPlayer.getDisplayName()); message = message.replace("%joblevel%", prog.getLevelFormatted()); message = message.replace("%lostLevel%", Integer.toString(oldLevel)); @@ -766,7 +767,8 @@ public class PlayerManager { message = message.replace("%titlename%", levelUpEvent.getOldTitle() .getChatColor().toString() + levelUpEvent.getOldTitle().getName()); - message = message.replace("%playername%", player != null ? plugin.getComplement().getDisplayName(player) : jPlayer.getName()); + message = message.replace("%playername%", jPlayer.getName()); + message = message.replace("%playerdisplayname%", jPlayer.getDisplayName()); message = message.replace("%joblevel%", prog.getLevelFormatted()); if (Jobs.getGCManager().isBroadcastingLevelups() || Jobs.getGCManager().LevelChangeActionBar || Jobs.getGCManager().LevelChangeChat) { @@ -798,7 +800,8 @@ public class PlayerManager { message = Jobs.getLanguage().getMessage("message.skillup." + (Jobs.getGCManager().isBroadcastingSkillups() ? "broadcast" : "nobroadcast")); - message = message.replace("%playername%", player != null ? plugin.getComplement().getDisplayName(player) : jPlayer.getName()); + message = message.replace("%playername%", jPlayer.getName()); + message = message.replace("%playerdisplayname%", jPlayer.getDisplayName()); message = message.replace("%titlename%", levelUpEvent.getNewTitle() .getChatColor().toString() + levelUpEvent.getNewTitle().getName()); message = message.replace("%jobname%", job.getDisplayName()); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/archive.java b/src/main/java/com/gamingmesh/jobs/commands/list/archive.java index d8f2bb7c..fe05db70 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/archive.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/archive.java @@ -40,7 +40,7 @@ public class archive implements Cmd { return true; } - sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", jPlayer.getName())); + sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName())); for (JobProgression jobInfo : allJobs) { RawMessage rm = new RawMessage(); if (jobInfo.canRejoin()) diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/editpoints.java b/src/main/java/com/gamingmesh/jobs/commands/list/editpoints.java index 39b6ea83..c1e50903 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/editpoints.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/editpoints.java @@ -35,6 +35,7 @@ public class editpoints implements Cmd { pointInfo.takePoints(amount); sender.sendMessage(Jobs.getLanguage().getMessage("command.editpoints.output.take", "%playername%", jPlayer.getName(), + "%playerdisplayname%", jPlayer.getDisplayName(), "%amount%", amount, "%total%", (int) (pointInfo.getCurrentPoints() * 100) / 100D)); break; @@ -42,6 +43,7 @@ public class editpoints implements Cmd { pointInfo.addPoints(amount); sender.sendMessage(Jobs.getLanguage().getMessage("command.editpoints.output.add", "%playername%", jPlayer.getName(), + "%playerdisplayname%", jPlayer.getDisplayName(), "%amount%", amount, "%total%", (int) (pointInfo.getCurrentPoints() * 100) / 100D)); break; @@ -49,6 +51,7 @@ public class editpoints implements Cmd { pointInfo.setPoints(amount); sender.sendMessage(Jobs.getLanguage().getMessage("command.editpoints.output.set", "%playername%", jPlayer.getName(), + "%playerdisplayname%", jPlayer.getDisplayName(), "%amount%", amount)); break; default: diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/gtop.java b/src/main/java/com/gamingmesh/jobs/commands/list/gtop.java index 7516130f..0ac0838b 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/gtop.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/gtop.java @@ -67,6 +67,7 @@ public class gtop implements Cmd { sender.sendMessage(Jobs.getLanguage().getMessage("command.gtop.output.list", "%number%", pi.getPositionForOutput(i), "%playername%", One.getPlayerInfo().getName(), + "%playerdisplayname%", One.getPlayerInfo().getDisplayName(), "%level%", One.getLevel(), "%exp%", One.getExp())); ++i; @@ -81,6 +82,7 @@ public class gtop implements Cmd { ls.add(Jobs.getLanguage().getMessage("scoreboard.line", "%number%", pi.getPositionForOutput(i), "%playername%", one.getPlayerInfo().getName(), + "%playerdisplayname%", one.getPlayerInfo().getDisplayName(), "%level%", one.getLevel())); ++i; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/log.java b/src/main/java/com/gamingmesh/jobs/commands/list/log.java index 1cd6678c..78dd37e3 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/log.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/log.java @@ -71,7 +71,7 @@ public class log implements Cmd { int count = 0; int max = 10; - sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.topline", "%playername%", JPlayer.getName())); + sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.topline", "%playername%", JPlayer.getName(), "%playerdisplayname%", JPlayer.getDisplayName())); for (Log one : logList.values()) { double totalMoney = 0, totalExp = 0, totalPoints = 0; diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/points.java b/src/main/java/com/gamingmesh/jobs/commands/list/points.java index 8b727f2a..204bd50a 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/points.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/points.java @@ -38,7 +38,7 @@ public class points implements Cmd { PlayerPoints pointInfo = jPlayer.getPointsData(); - sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", jPlayer.getName())); + sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName())); sender.sendMessage(Jobs.getLanguage().getMessage("command.points.currentpoints", "%currentpoints%", (int) (pointInfo.getCurrentPoints() * 100) / 100D)); sender.sendMessage(Jobs.getLanguage().getMessage("command.points.totalpoints", "%totalpoints%", (int) (pointInfo.getTotalPoints() * 100) / 100D)); sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator")); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/resetlimit.java b/src/main/java/com/gamingmesh/jobs/commands/list/resetlimit.java index 323a0a98..6bf6d018 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/resetlimit.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/resetlimit.java @@ -33,7 +33,7 @@ public class resetlimit implements Cmd { } jPlayer.resetPaymentLimit(); - sender.sendMessage(Jobs.getLanguage().getMessage("command.resetlimit.output.reseted", "%playername%", jPlayer.getName())); + sender.sendMessage(Jobs.getLanguage().getMessage("command.resetlimit.output.reseted", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName())); return true; } } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/resetquest.java b/src/main/java/com/gamingmesh/jobs/commands/list/resetquest.java index a27e6a4e..75c1e0b0 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/resetquest.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/resetquest.java @@ -51,7 +51,7 @@ public class resetquest implements Cmd { } jPlayer.resetQuests(quests); - sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquest.output.reseted", "%playername%", jPlayer.getName())); + sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquest.output.reseted", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getName())); return true; } } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/resetquesttotal.java b/src/main/java/com/gamingmesh/jobs/commands/list/resetquesttotal.java index 1e9c5050..d66edd83 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/resetquesttotal.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/resetquesttotal.java @@ -52,7 +52,7 @@ public class resetquesttotal implements Cmd { jPlayer.setDoneQuests(0); jPlayer.setSaved(false); jPlayer.save(); - sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquesttotal.output.reseted", "%playername%", jPlayer.getName())); + sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquesttotal.output.reseted", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName())); return true; } } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/stats.java b/src/main/java/com/gamingmesh/jobs/commands/list/stats.java index a53d70ab..c07c8b76 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/stats.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/stats.java @@ -20,7 +20,6 @@ public class stats implements Cmd { if (args.length >= 1) { if (!Jobs.hasPermission(sender, "jobs.command.admin.stats", true)) return true; - jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); } else if (sender instanceof Player) jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender); @@ -38,7 +37,7 @@ public class stats implements Cmd { return true; } - sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", jPlayer.getName())); + sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName())); String leftClick = Jobs.getLanguage().getMessage("command.info.gui.leftClick"); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/top.java b/src/main/java/com/gamingmesh/jobs/commands/list/top.java index a9190673..ee6ac9f2 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/top.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/top.java @@ -56,8 +56,8 @@ public class top implements Cmd { int workingIn = Jobs.getUsedSlots(job); PageInfo pi = new PageInfo(Jobs.getGCManager().JobsTopAmount, workingIn, page); - List FullList = Jobs.getJobsDAO().toplist(job.getName(), pi.getStart()); - if (FullList.isEmpty()) { + List fullList = Jobs.getJobsDAO().toplist(job.getName(), pi.getStart()); + if (fullList.isEmpty()) { player.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfo")); return true; } @@ -68,26 +68,27 @@ public class top implements Cmd { if (!Jobs.getGCManager().ShowToplistInScoreboard) { player.sendMessage(Jobs.getLanguage().getMessage("command.top.output.topline", "%jobname%", job.getName(), "%amount%", Jobs.getGCManager().JobsTopAmount)); - for (TopList One : FullList) { + for (TopList one : fullList) { if (place > Jobs.getGCManager().JobsTopAmount) break; player.sendMessage(Jobs.getLanguage().getMessage("command.top.output.list", "%number%", ((page - 1) * Jobs.getGCManager().JobsTopAmount) + place, - "%playername%", One.getPlayerInfo().getName(), - "%level%", One.getLevel(), - "%exp%", One.getExp())); + "%playername%", one.getPlayerInfo().getName(), + "%playerdisplayname%", one.getPlayerInfo().getDisplayName(), + "%level%", one.getLevel(), + "%exp%", one.getExp())); place++; } plugin.showPagination(sender, pi, "jobs top " + job.getName()); } else { List ls = new ArrayList<>(); - for (TopList one : FullList) { + for (TopList one : fullList) { if (place > Jobs.getGCManager().JobsTopAmount) break; ls.add(Jobs.getLanguage().getMessage("scoreboard.line", "%number%", ((page - 1) * Jobs.getGCManager().JobsTopAmount) + place, - "%playername%", one.getPlayerInfo().getName(), "%level%", one.getLevel())); + "%playername%", one.getPlayerInfo().getName(), "%playerdisplayname%", one.getPlayerInfo().getDisplayName(), "%level%", one.getLevel())); place++; } diff --git a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java index 81ee293e..aaf2f487 100644 --- a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java @@ -72,9 +72,12 @@ public class LanguageManager { Jobs.getGCManager().getCommandArgs().clear(); + c.addHeaderComments(new ArrayList(Arrays.asList( + "%playername% or %playerdisplayname% can be used to include ether players original name or his display name which can be colored and use players nick name"))); + c.get("economy.error.nomoney", "&cSorry, no money left in national bank!"); c.get("limitedItem.error.levelup", "&cYou need to level up in [jobname] to use this item!"); - c.get("general.info.toplineseparator", "&7*********************** &6%playername% &7***********************"); + c.get("general.info.toplineseparator", "&7*********************** &6%playerdisplayname% &7***********************"); c.get("general.info.separator", "&7*******************************************************"); c.get("general.info.time.days", "&e%days% &6days "); c.get("general.info.time.hours", "&e%hours% &6hours "); @@ -95,6 +98,7 @@ public class LanguageManager { c.get("general.error.noCommand", "&cThere is no command by this name!"); c.get("general.error.permission", "&cYou do not have permission to do that!"); c.get("general.error.noinfo", "&cNo information found!"); + c.addComment("general.error.noinfoByPlayer", "Only %playername% can be used here"); c.get("general.error.noinfoByPlayer", "&cNo information found by [%playername%] player name!"); c.get("general.error.ingame", "&cYou can use this command only in game!"); c.get("general.error.fromconsole", "&cYou can use this command only from console!"); @@ -211,27 +215,27 @@ public class LanguageManager { c.get("command.limit.output.reachedpointslimit2", "&eYou can check your limit with &2/jobs limit &ecommand"); c.get("command.limit.output.notenabled", "&eMoney limit is not enabled"); - c.get("command.resetexploreregion.help.info", "Resets region data of Explorering"); - c.get("command.resetexploreregion.help.args", "world [worldname]"); - Jobs.getGCManager().getCommandArgs().put("resetlimit", Arrays.asList("world", "[worldname]")); - c.get("command.resetexploreregion.output.notenabled", "&eNot enabled."); - c.get("command.resetexploreregion.output.invalidname", "&eInvalid world name"); - c.get("command.resetexploreregion.output.reseted", "&eExploring region data has been reset for: &2%worldname%"); + c.get("command.resetexploreregion.help.info", "Resets region data of Explorering"); + c.get("command.resetexploreregion.help.args", "world [worldname]"); + Jobs.getGCManager().getCommandArgs().put("resetlimit", Arrays.asList("world", "[worldname]")); + c.get("command.resetexploreregion.output.notenabled", "&eNot enabled."); + c.get("command.resetexploreregion.output.invalidname", "&eInvalid world name"); + c.get("command.resetexploreregion.output.reseted", "&eExploring region data has been reset for: &2%worldname%"); - c.get("command.resetlimit.help.info", "Resets a player's payment limits"); + c.get("command.resetlimit.help.info", "Resets a player's payment limits"); c.get("command.resetlimit.help.args", "[playername]"); Jobs.getGCManager().getCommandArgs().put("resetlimit", Arrays.asList("[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%playerdisplayname%"); c.get("command.resetquesttotal.help.info", "Resets a player's done quest counter"); c.get("command.resetquesttotal.help.args", "[playername]/all"); Jobs.getGCManager().getCommandArgs().put("resetquesttotal", Arrays.asList("[playername]%%all")); - c.get("command.resetquesttotal.output.reseted", "&eDone quests have been reset for: &2%playername%"); + c.get("command.resetquesttotal.output.reseted", "&eDone quests have been reset for: &2%playerdisplayname%"); c.get("command.resetquest.help.info", "Resets a player's quest"); c.get("command.resetquest.help.args", "[playername] [jobname]"); Jobs.getGCManager().getCommandArgs().put("resetquest", Arrays.asList("[playername]", "[jobname]")); - c.get("command.resetquest.output.reseted", "&eQuest has been reset for: &2%playername%"); + c.get("command.resetquest.output.reseted", "&eQuest has been reset for: &2%playerdisplayname%"); c.get("command.resetquest.output.noQuests", "&eCan't find any quests"); c.get("command.points.help.info", "Shows how much points does a player have."); @@ -243,9 +247,9 @@ public class LanguageManager { c.get("command.editpoints.help.info", "Edit player's points."); c.get("command.editpoints.help.args", "set/add/take [playername] [amount]"); Jobs.getGCManager().getCommandArgs().put("editpoints", Arrays.asList("set%%add%%take", "[playername]")); - c.get("command.editpoints.output.set", "&ePlayers (&6%playername%&e) points was set to &6%amount%"); - c.get("command.editpoints.output.add", "&ePlayer (&6%playername%&e) got additional &6%amount% &epoints. Now they have &6%total%"); - c.get("command.editpoints.output.take", "&ePlayer (&6%playername%&e) lost &6%amount% &epoints. Now they have &6%total%"); + c.get("command.editpoints.output.set", "&ePlayers (&6%playerdisplayname%&e) points was set to &6%amount%"); + c.get("command.editpoints.output.add", "&ePlayer (&6%playerdisplayname%&e) got additional &6%amount% &epoints. Now they have &6%total%"); + c.get("command.editpoints.output.take", "&ePlayer (&6%playerdisplayname%&e) lost &6%amount% &epoints. Now they have &6%total%"); c.get("command.editjobs.help.info", "Edit current jobs."); c.get("command.editjobs.help.args", ""); @@ -343,7 +347,7 @@ public class LanguageManager { c.get("command.give.help.info", "Gives item by jobs name and item category name. Player name is optional"); c.get("command.give.help.args", "[playername] [jobname] [items/limiteditems] [jobitemname]"); - Jobs.getGCManager().getCommandArgs().put("give", Arrays.asList("[playername]", "[jobname]", "items%%limiteditems","[jobitemname]")); + Jobs.getGCManager().getCommandArgs().put("give", Arrays.asList("[playername]", "[jobname]", "items%%limiteditems", "[jobitemname]")); c.get("command.give.output.notonline", "&4Player with that name is not online!"); c.get("command.give.output.noitem", "&4Can't find any item by given name!"); @@ -484,7 +488,7 @@ public class LanguageManager { 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.ownedblocks.help.info", "Check block ownership"); c.get("command.ownedblocks.help.args", "[playername]"); Jobs.getGCManager().getCommandArgs().put("ownedblocks", Arrays.asList("[playername]")); @@ -542,18 +546,14 @@ public class LanguageManager { Jobs.getGCManager().getCommandArgs().put("top", Arrays.asList("[jobname]")); c.get("command.top.error.nojob", "Can't find any job with this name."); c.get("command.top.output.topline", "&aTop&e %amount% &aplayers by &e%jobname% &ajob"); - c.get("command.top.output.list", "&e%number%&a. &e%playername% &alvl &e%level% &awith&e %exp% &aexp"); - c.get("command.top.output.prev", "&e<<<<< Prev page &2|"); - c.get("command.top.output.next", "&2|&e Next Page >>>>"); + c.get("command.top.output.list", "&e%number%&a. &e%playerdisplayname% &alvl &e%level% &awith&e %exp% &aexp"); c.get("command.top.output.show", "&2Show from &e[from] &2until &e[until] &2top list"); c.get("command.gtop.help.info", "Shows top players by global jobs level."); c.get("command.gtop.help.args", "clear/pageNumber"); c.get("command.gtop.error.nojob", "Can't find any information."); c.get("command.gtop.output.topline", "&aTop&e %amount% &aplayers by global job level"); - c.get("command.gtop.output.list", "&e%number%&a. &e%playername% &alvl &e%level% &awith&e %exp% &aexp"); - c.get("command.gtop.output.prev", "&e<<<<< Prev page &2|"); - c.get("command.gtop.output.next", "&2|&e Next Page >>>>"); + c.get("command.gtop.output.list", "&e%number%&a. &e%playerdisplayname% &alvl &e%level% &awith&e %exp% &aexp"); c.get("command.gtop.output.show", "&2Show from &e[from] &2until &e[until] &2global top list"); c.get("command.area.help.info", "Modify restricted areas."); @@ -578,7 +578,7 @@ public class LanguageManager { c.get("command.log.help.info", "Shows statistics."); c.get("command.log.help.args", "[playername]"); Jobs.getGCManager().getCommandArgs().put("log", Arrays.asList("[playername]")); - c.get("command.log.output.topline", "&7************************* &6%playername% &7*************************"); + c.get("command.log.output.topline", "&7************************* &6%playerdisplayname% &7*************************"); c.get("command.log.output.ls", "&7* &6%number%. &3%action%: &6%item% &eqty: %qty% %money%%exp%%points%"); c.get("command.log.output.money", "&6money: %amount% "); c.get("command.log.output.exp", "&eexp: %amount% "); @@ -669,12 +669,11 @@ public class LanguageManager { c.get("command.version.output.newVault", "&eVault: &6[version] "); c.get("command.version.output.CMILib", "&eCMILib: &6[version] "); c.get("command.version.output.cmilVersionNew", "&e-> [newVersion]"); - - - c.get("message.skillup.broadcast", "%playername% has been promoted to a %titlename% %jobname%."); + + c.get("message.skillup.broadcast", "%playerdisplayname% has been promoted to a %titlename% %jobname%."); c.get("message.skillup.nobroadcast", "Congratulations, you have been promoted to a %titlename% %jobname%."); - c.get("message.levelup.broadcast", "%playername% is now a level %joblevel% %jobname%."); + c.get("message.levelup.broadcast", "%playerdisplayname% is now a level %joblevel% %jobname%."); c.get("message.levelup.nobroadcast", "You are now level %joblevel% %jobname%."); c.get("message.leveldown.message", "&cYou lost level&e %lostLevel%&c in&e %jobname%&c job! Level:&6 %joblevel%&c."); @@ -719,7 +718,7 @@ public class LanguageManager { //c.get("scoreboard.clear", "&eIf you want to remove scoreboard, type &2/jobs top clear"); c.get("scoreboard.topline", "&2Top &e%jobname%"); c.get("scoreboard.gtopline", "&2Global top list"); - c.get("scoreboard.line", "&2%number%. &e%playername% (&6%level%&e)"); + c.get("scoreboard.line", "&2%number%. &e%playerdisplayname% &e(&6%level%&e)"); signKeys.clear(); signKeys.addAll(c.getC().getConfigurationSection("signs.secondline").getKeys(false)); diff --git a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java index 4c8638f4..99e9f93f 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java @@ -488,6 +488,17 @@ public class JobsPlayer { return userName; } + public String getDisplayName() { + if (!this.isOnline()) + return getName(); + Player p = this.getPlayer(); + + if (p == null) + return getName(); + + return p.getDisplayName() == null || p.getDisplayName().isEmpty() ? getName() : p.getDisplayName(); + } + /** * get the playerUUID * @return the playerUUID diff --git a/src/main/java/com/gamingmesh/jobs/container/PlayerInfo.java b/src/main/java/com/gamingmesh/jobs/container/PlayerInfo.java index c8e9bd1d..84abdb36 100644 --- a/src/main/java/com/gamingmesh/jobs/container/PlayerInfo.java +++ b/src/main/java/com/gamingmesh/jobs/container/PlayerInfo.java @@ -54,6 +54,16 @@ public class PlayerInfo { return player; } + public String getDisplayName() { + if (player == null) + player = Jobs.getPlayerManager().getJobsPlayer(uuid); + + if (player == null) + return getName(); + + return player.getDisplayName(); + } + public Integer getQuestsDone() { return questsDone; }