From 51ab8d4b2555a9a848e14115a3dc61a84c016418 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 12 Jan 2019 22:41:06 -0800 Subject: [PATCH] Child Skill commands work again (UGLY tho) --- .../nossr50/commands/skills/SkillCommand.java | 34 +++++++++---------- .../commands/skills/SmeltingCommand.java | 2 +- .../resources/locale/locale_en_US.properties | 5 +-- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java index df32059bc..095d3aa7d 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java @@ -2,6 +2,7 @@ package com.gmail.nossr50.commands.skills; import java.text.DecimalFormat; import java.util.List; +import java.util.Set; import com.gmail.nossr50.datatypes.skills.PrimarySkill; @@ -10,6 +11,7 @@ import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.skills.child.FamilyTree; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.StringUtils; @@ -119,15 +121,15 @@ public abstract class SkillCommand implements TabExecutor { } private void sendSkillCommandHeader(Player player, McMMOPlayer mcMMOPlayer, int skillValue) { + ChatColor hd1 = ChatColor.DARK_AQUA; + ChatColor c1 = ChatColor.GOLD; + ChatColor c2 = ChatColor.RED; + + + player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName)); if(!skill.isChildSkill()) { - ChatColor hd1 = ChatColor.DARK_AQUA; - ChatColor c1 = ChatColor.GOLD; - ChatColor c2 = ChatColor.RED; - - player.sendMessage(hd1+"[]=====[]"+c1+" "+skillName+" "+hd1+"[]=====[]"); - //XP GAIN METHOD player.sendMessage(LocaleLoader.getString("Commands.XPGain.Overhaul", LocaleLoader.getString("Commands.XPGain." + StringUtils.getCapitalized(skill.toString())))); @@ -135,23 +137,19 @@ public abstract class SkillCommand implements TabExecutor { player.sendMessage(LocaleLoader.getString("Effects.Level.Overhaul", skillValue, mcMMOPlayer.getSkillXpLevel(skill), mcMMOPlayer.getXpToLevel(skill))); } else { - ChatColor hd1 = ChatColor.DARK_AQUA; - ChatColor c1 = ChatColor.GOLD; - ChatColor c2 = ChatColor.DARK_PURPLE; - //Header - player.sendMessage(hd1+"[]=====[]"+c1+" mcMMO "+c2+"Overhaul"+c1+" Era "+hd1+"[]=====[]"); - //Link Header - TextComponentFactory.sendPlayerUrlHeader(player); - player.sendMessage(hd1+"[]=====[]"+c1+" "+skillName+" "+hd1+"[]=====[]"); - //XP GAIN METHOD - player.sendMessage(LocaleLoader.getString("Commands.XPGain", LocaleLoader.getString("Commands.XPGain." + StringUtils.getCapitalized(skill.toString())))); + player.sendMessage(LocaleLoader.getString("Commands.XPGain.Overhaul", LocaleLoader.getString("Commands.XPGain.Child"))); //LEVEL - player.sendMessage(LocaleLoader.getString("Effects.Level", skillValue, mcMMOPlayer.getSkillXpLevel(skill), mcMMOPlayer.getXpToLevel(skill))); + player.sendMessage(LocaleLoader.getString("Effects.Child.Overhaul", skillValue, skillValue)); + Set parents = FamilyTree.getParents(skill); + + //TODO: Add JSON here + for (PrimarySkill parent : parents) { + player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level.Overhaul", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent))); + } } - /* if (!skill.isChildSkill()) { player.sendMessage(LocaleLoader.getString("Skills.Header", skillName)); diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java index 46c30102e..5bee63045 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java @@ -124,7 +124,7 @@ public class SmeltingCommand extends SkillCommand { protected List getTextComponents(Player player) { List textComponents = new ArrayList<>(); - TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.SWORDS); + TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.SMELTING); return textComponents; } diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index aa3f1b21a..08923f8b9 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -292,8 +292,8 @@ Repair.Arcane.Rank=[[RED]]Arcane Forging: [[YELLOW]]Rank {0}/{1} Salvage.Pretty.Name=Salvage Salvage.SubSkill.AdvancedSalvage.Name=Advanced Salvage Salvage.SubSkill.AdvancedSalvage.Description=Salvage damaged items -Salvage.SubSkill.ArcaneSalvaging.Name=Arcane Salvaging -Salvage.SubSkill.ArcaneSalvaging.Description=Extract enchantments from items +Salvage.SubSkill.ArcaneSalvage.Name=Arcane Salvaging +Salvage.SubSkill.ArcaneSalvage.Description=Extract enchantments from items Salvage.Ability.Locked.0=LOCKED UNTIL {0}+ SKILL (ADVANCED SALVAGE) Salvage.Ability.Bonus.0=Advanced Salvage Salvage.Ability.Bonus.1=Max yield {0} item destroyed @@ -747,6 +747,7 @@ XPRate.Event= [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x! Effects.Effects=EFFECTS Effects.SubSkills.Overhaul=Sub-Skills Effects.Child=[[DARK_GRAY]]LVL: [[GREEN]]{0} +Effects.Child.Overhaul=[[DARK_GRAY]]LVL: [[GREEN]]{0} Effects.Level=[[DARK_GRAY]]LVL: [[GREEN]]{0} [[DARK_AQUA]]XP[[YELLOW]]([[GOLD]]{1}[[YELLOW]]/[[GOLD]]{2}[[YELLOW]]) Effects.Level.Overhaul=[[RED]]LVL: [[GREEN]]{0} [[DARK_AQUA]]XP[[YELLOW]]([[GOLD]]{1}[[YELLOW]]/[[GOLD]]{2}[[YELLOW]]) Effects.Parent = [[GOLD]]{0} -