diff --git a/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java b/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java index 6ead3cc8d..6bd13b826 100644 --- a/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java +++ b/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java @@ -378,7 +378,15 @@ public class TextComponentFactory { addSubSkillTypeToHoverEventJSON(abstractSubSkill, componentBuilder); //RANK - addRanked(ccRank, ccCurRank, ccPossessive, ccNumRanks, componentBuilder, abstractSubSkill.getNumRanks(), RankUtils.getRank(player, abstractSubSkill)); + int curRank = RankUtils.getRank(player, abstractSubSkill); + int nextRank = 0; + + if(curRank < abstractSubSkill.getNumRanks() && abstractSubSkill.getNumRanks() > 0) + { + nextRank = RankUtils.getRankUnlockLevel(abstractSubSkill, curRank+1); + } + + addRanked(ccRank, ccCurRank, ccPossessive, ccNumRanks, componentBuilder, abstractSubSkill.getNumRanks(), RankUtils.getRank(player, abstractSubSkill), nextRank); componentBuilder.append(LocaleLoader.getString("JSON.DescriptionHeader")); componentBuilder.append("\n").append(abstractSubSkill.getDescription()).append("\n"); @@ -401,15 +409,19 @@ public class TextComponentFactory { return componentBuilder; } - private static void addRanked(ChatColor ccRank, ChatColor ccCurRank, ChatColor ccPossessive, ChatColor ccNumRanks, ComponentBuilder componentBuilder, int numRanks, int rank) { + private static void addRanked(ChatColor ccRank, ChatColor ccCurRank, ChatColor ccPossessive, ChatColor ccNumRanks, ComponentBuilder componentBuilder, int numRanks, int rank, int nextRank) { if (numRanks > 0) { - //Rank - componentBuilder.append(LocaleLoader.getString("JSON.Rank") + ": ").bold(false).color(ccRank); + //Rank: x + componentBuilder.append(LocaleLoader.getString("JSON.Hover.Rank", String.valueOf(rank))).append("\n") + .bold(false).italic(false).strikethrough(false).underlined(false); - //x of y - componentBuilder.append(String.valueOf(rank)).color(ccCurRank); - componentBuilder.append(" " + LocaleLoader.getString("JSON.RankPossesive") + " ").color(ccPossessive); - componentBuilder.append(String.valueOf(numRanks)).color(ccNumRanks); + //Next Rank: x + if(nextRank > rank) + componentBuilder.append(LocaleLoader.getString("JSON.Hover.NextRank", String.valueOf(nextRank))).append("\n") + .bold(false).italic(false).strikethrough(false).underlined(false); + + /*componentBuilder.append(" " + LocaleLoader.getString("JSON.RankPossesive") + " ").color(ccPossessive); + componentBuilder.append(String.valueOf(numRanks)).color(ccNumRanks);*/ } } @@ -468,12 +480,19 @@ public class TextComponentFactory { //RANK if(subSkillType.getNumRanks() > 0) { - addRanked(ccRank, ccCurRank, ccPossessive, ccNumRanks, componentBuilder, subSkillType.getNumRanks(), RankUtils.getRank(player, subSkillType)); + int curRank = RankUtils.getRank(player, subSkillType); + int nextRank = 0; + + if(curRank < subSkillType.getNumRanks() && subSkillType.getNumRanks() > 0) + { + nextRank = RankUtils.getRankUnlockLevel(subSkillType, curRank+1); + } + + addRanked(ccRank, ccCurRank, ccPossessive, ccNumRanks, componentBuilder, subSkillType.getNumRanks(), RankUtils.getRank(player, subSkillType), nextRank); - //Empty line - componentBuilder.append("\n").bold(false); } + componentBuilder.append("\n").bold(false); componentBuilder.append(LocaleLoader.getString("JSON.DescriptionHeader")); componentBuilder.color(ccDescriptionHeader); componentBuilder.append("\n"); diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index f11efc882..bc35ee257 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -45,6 +45,8 @@ JSON.URL.Spigot=The official mcMMO Spigot Resource Page! JSON.URL.Translation=Translate mcMMO into other languages! JSON.URL.Wiki=The official mcMMO wiki! JSON.SkillUnlockMessage=[[GOLD]][ mcMMO[[YELLOW]] @[[DARK_AQUA]]{0} [[GOLD]]Rank [[DARK_AQUA]]{1}[[GOLD]] Unlocked! ] +JSON.Hover.Rank=&e&lRank:&r &f{0} +JSON.Hover.NextRank=&7&oNext upgrade at level {0} #This is the message sent to players when an ability is activated JSON.Notification.SuperAbility={0}