From e8c8f8b6a19cfb5304850d58e9bbf0b654355792 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 21 Jan 2019 07:27:09 -0800 Subject: [PATCH] Level up messages are now easier to modify in the Locale --- .../nossr50/datatypes/player/McMMOPlayer.java | 2 +- .../nossr50/util/TextComponentFactory.java | 13 ++----- .../util/player/NotificationManager.java | 4 +- src/main/resources/advanced.yml | 4 +- .../resources/locale/locale_en_US.properties | 39 +++++++++++-------- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java index b90896a34..f9728a150 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -563,7 +563,7 @@ public class McMMOPlayer { * Check to see if the player unlocked any new skills */ - NotificationManager.sendPlayerLevelUpNotification(UserManager.getPlayer(player), primarySkillType, profile.getSkillLevel(primarySkillType)); + NotificationManager.sendPlayerLevelUpNotification(UserManager.getPlayer(player), primarySkillType, levelsGained, profile.getSkillLevel(primarySkillType)); //UPDATE XP BARS UserManager.getPlayer(player).processPostXpEvent(xpGainReason, primarySkillType, mcMMO.p); diff --git a/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java b/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java index 73c8c373c..d950e4626 100644 --- a/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java +++ b/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java @@ -13,6 +13,7 @@ import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; import com.gmail.nossr50.listeners.InteractionManager; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.skills.RankUtils; +import com.gmail.nossr50.util.skills.SkillUtils; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.*; @@ -45,17 +46,9 @@ public class TextComponentFactory { return getNotificationTextComponent(LocaleLoader.getString(localeKey)); } - public static TextComponent getNotificationLevelUpTextComponent(McMMOPlayer player, PrimarySkillType skill, int currentLevel) + public static TextComponent getNotificationLevelUpTextComponent(PrimarySkillType skill, int levelsGained, int currentLevel) { - //player.sendMessage(LocaleLoader.getString(StringUtils.getCapitalized(primarySkill.toString()) + ".Skillup", levelsGained, getSkillLevel(primarySkill))); - TextComponent textComponent = new TextComponent(LocaleLoader.getString("JSON."+StringUtils.getCapitalized(skill.toString())) - +" "+LocaleLoader.getString("JSON.LevelUp")); - textComponent.setColor(AdvancedConfig.getInstance().getJSONActionBarColor(NotificationType.LEVEL_UP_MESSAGE)); - TextComponent childComponent = new TextComponent(" "+currentLevel); - //TODO: Config - childComponent.setColor(ChatColor.GREEN); - childComponent.setBold(true); - textComponent.addExtra(childComponent); + TextComponent textComponent = new TextComponent(LocaleLoader.getString("Overhaul.Levelup", LocaleLoader.getString("Overhaul.Name."+StringUtils.getCapitalized(skill.toString())), levelsGained, currentLevel)); return textComponent; } diff --git a/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java b/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java index d1051c776..d1a597522 100644 --- a/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java +++ b/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java @@ -102,11 +102,11 @@ public class NotificationManager { * @param skillName skill that leveled up * @param newLevel new level of that skill */ - public static void sendPlayerLevelUpNotification(McMMOPlayer mcMMOPlayer, PrimarySkillType skillName, int newLevel) + public static void sendPlayerLevelUpNotification(McMMOPlayer mcMMOPlayer, PrimarySkillType skillName, int levelsGained, int newLevel) { ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(NotificationType.LEVEL_UP_MESSAGE) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM; - TextComponent levelUpTextComponent = TextComponentFactory.getNotificationLevelUpTextComponent(mcMMOPlayer, skillName, newLevel); + TextComponent levelUpTextComponent = TextComponentFactory.getNotificationLevelUpTextComponent(skillName, levelsGained, newLevel); McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(mcMMOPlayer.getPlayer(), NotificationType.LEVEL_UP_MESSAGE, destination, levelUpTextComponent); sendNotification(mcMMOPlayer.getPlayer(), customEvent); diff --git a/src/main/resources/advanced.yml b/src/main/resources/advanced.yml index 8c8ecf9fa..f2655df92 100644 --- a/src/main/resources/advanced.yml +++ b/src/main/resources/advanced.yml @@ -38,7 +38,7 @@ Feedback: SendCopyOfMessageToChat: false LevelUps: Enabled: true - SendCopyOfMessageToChat: false + SendCopyOfMessageToChat: true Holiday: Enabled: true SendCopyOfMessageToChat: true @@ -59,7 +59,7 @@ Feedback: SendCopyOfMessageToChat: false SuperAbilityAlertOthers: Enabled: true - SendCopyOfMessageToChat: false + SendCopyOfMessageToChat: true ExperienceGain: Enabled: true SendCopyOfMessageToChat: false diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index a666aaa03..bc7ae8279 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -21,7 +21,6 @@ JSON.JWrapper.Duration=Duration: JSON.JWrapper.Target.Type=Target Type: JSON.JWrapper.Target.Block=Block JSON.JWrapper.Target.Player=Player -JSON.JWrapper.Target.Mobs=Mobs JSON.JWrapper.Perks.Header=[[GOLD]]Lucky Perks JSON.JWrapper.Perks.Lucky={0}% Better Odds JSON.Hover.Tips=Tips @@ -39,7 +38,6 @@ JSON.Swords=Swords JSON.Taming=Taming JSON.Unarmed=Unarmed JSON.Woodcutting=Woodcutting -JSON.LevelUp=increased to JSON.URL.Website=The official mcMMO Website! JSON.URL.Discord=The official mcMMO Discord server! JSON.URL.Patreon=Support nossr50 and his work for mcMMO on Patreon! @@ -78,6 +76,23 @@ Overhaul.mcMMO.Header=[[RED]][]=====[][[GREEN]] mcMMO - Overhaul Era [[RED]][]== Overhaul.mcMMO.Url.Wrap.Prefix=[[RED]][| Overhaul.mcMMO.Url.Wrap.Suffix=[[RED]]|] Overhaul.mcMMO.MmoInfo.Wiki=[[YELLOW]][[[WHITE]]View this skill on the wiki![[YELLOW]]] +# Overhaul.Levelup can take {0} - Skill Name defined in Overhaul.Name {1} - Amount of levels gained {2} - Level in skill +Overhaul.Levelup=[[BOLD]]{0} increased to [[RESET]][[GREEN]][[BOLD]]{2}[[RESET]][[WHITE]]. +Overhaul.Name.Acrobatics=Acrobatics +Overhaul.Name.Alchemy=Alchemy +Overhaul.Name.Archery=Archery +Overhaul.Name.Axes=Axes +Overhaul.Name.Excavation=Excavation +Overhaul.Name.Fishing=Fishing +Overhaul.Name.Herbalism=Herbalism +Overhaul.Name.Mining=Mining +Overhaul.Name.Repair=Repair +Overhaul.Name.Salvage=Salvage +Overhaul.Name.Smelting=Smelting +Overhaul.Name.Swords=Swords +Overhaul.Name.Taming=Taming +Overhaul.Name.Unarmed=Unarmed +Overhaul.Name.Woodcutting=Woodcutting # /mcMMO Command Style Stuff Commands.mcc.Header=[[RED]]---[][[GREEN]]mcMMO Commands[[RED]][]--- Commands.Other=[[RED]]---[][[GREEN]]SPECIAL COMMANDS[[RED]][]--- @@ -123,7 +138,6 @@ Acrobatics.SubSkill.Dodge.Description=Reduce attack damage by half Acrobatics.Listener=Acrobatics: Acrobatics.Roll.Text=**Rolled** Acrobatics.SkillName=ACROBATICS -Acrobatics.Skillup=Acrobatics skill increased by {0}. Total ({1}) #ALCHEMY Alchemy.SubSkill.Catalysis.Name=Catalysis Alchemy.SubSkill.Catalysis.Description=Increases potion brewing speed @@ -135,7 +149,6 @@ Alchemy.Catalysis.Speed=Brewing Speed: [[YELLOW]]{0} Alchemy.Concoctions.Rank=Concoctions Rank: [[YELLOW]]{0}/{1} Alchemy.Concoctions.Ingredients=Ingredients [[[YELLOW]]{0}[[RED]]]: [[YELLOW]]{1} Alchemy.SkillName=ALCHEMY -Alchemy.Skillup=Alchemy skill increased by {0}. Total ({1}) #ARCHERY Archery.Combat.DazeChance=Chance to Daze: [[YELLOW]]{0} Archery.Combat.RetrieveChance=Chance to Retrieve Arrows: [[YELLOW]]{0} @@ -148,7 +161,6 @@ Archery.SubSkill.ArrowRetrieval.Name=Arrow Retrieval Archery.SubSkill.ArrowRetrieval.Description=Chance to retrieve arrows from corpses Archery.Listener=Archery: Archery.SkillName=ARCHERY -Archery.Skillup=Archery skill increased by {0}. Total ({1}) #AXES Axes.Ability.Bonus.0=Axe Mastery Axes.Ability.Bonus.1=Bonus {0} damage @@ -182,7 +194,6 @@ Axes.Skills.SS.On=[[GREEN]]**Skull Splitter ACTIVATED** Axes.Skills.SS.Refresh=[[GREEN]]Your [[YELLOW]]Skull Splitter [[GREEN]]ability is refreshed! Axes.Skills.SS.Other.Off=Skull Splitter[[GREEN]] has worn off for [[YELLOW]]{0} Axes.Skills.SS.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]Skull Splitter! -Axes.Skillup=Axes skill increased by {0}. Total ({1}) #EXCAVATION Excavation.Ability.Lower=[[GRAY]]You lower your shovel. Excavation.Ability.Ready=[[DARK_AQUA]]You [[GOLD]]ready[[DARK_AQUA]] your Shovel. @@ -198,7 +209,6 @@ Excavation.Skills.GigaDrillBreaker.On=[[GREEN]]**GIGA DRILL BREAKER ACTIVATED** Excavation.Skills.GigaDrillBreaker.Refresh=[[GREEN]]Your [[YELLOW]]Giga Drill Breaker [[GREEN]]ability is refreshed! Excavation.Skills.GigaDrillBreaker.Other.Off=Giga Drill Breaker[[GREEN]] has worn off for [[YELLOW]]{0} Excavation.Skills.GigaDrillBreaker.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]Giga Drill Breaker! -Excavation.Skillup=Excavation skill increased by {0}. Total ({1}) #FISHING Fishing.Ability.Chance=Bite Chance: [[YELLOW]]{0} Fishing.Ability.Info=Magic Hunter: [[GRAY]] **Improves With Treasure Hunter Rank** @@ -229,7 +239,6 @@ Fishing.Ability.TH.MagicFound=[[GRAY]]You feel a touch of magic with this catch. Fishing.Ability.TH.Boom=[[GRAY]]BOOM TIME!!! Fishing.Ability.TH.Poison=[[GRAY]]Something doesn't smell quite right... Fishing.SkillName=FISHING -Fishing.Skillup=Fishing skill increased by {0}. Total ({1}) #HERBALISM Herbalism.Ability.DoubleDropChance=Double Drop Chance: [[YELLOW]]{0} Herbalism.Ability.FD=Farmer''s Diet: [[YELLOW]]Rank {0} @@ -266,7 +275,6 @@ Herbalism.Skills.GTe.On=[[GREEN]]**GREEN TERRA ACTIVATED** Herbalism.Skills.GTe.Refresh=[[GREEN]]Your [[YELLOW]]Green Terra [[GREEN]]ability is refreshed! Herbalism.Skills.GTe.Other.Off=Green Terra[[GREEN]] has worn off for [[YELLOW]]{0} Herbalism.Skills.GTe.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]Green Terra! -Herbalism.Skillup=Herbalism skill increased by {0}. Total ({1}) #MINING Mining.Ability.Length=Super Breaker Length: [[YELLOW]]{0}s Mining.Ability.Locked.0=LOCKED UNTIL {0}+ SKILL (BLAST MINING) @@ -293,7 +301,6 @@ Mining.Skills.SuperBreaker.On=[[GREEN]]**SUPER BREAKER ACTIVATED** Mining.Skills.SuperBreaker.Other.Off=Super Breaker[[GREEN]] has worn off for [[YELLOW]]{0} Mining.Skills.SuperBreaker.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]Super Breaker! Mining.Skills.SuperBreaker.Refresh=[[GREEN]]Your [[YELLOW]]Super Breaker [[GREEN]]ability is refreshed! -Mining.Skillup=Mining skill increased by {0}. Total ({1}) #Blast Mining Mining.Blast.Boom=[[GRAY]]**BOOM** Mining.Blast.Cooldown= @@ -333,7 +340,6 @@ Repair.Skills.FullDurability=[[GRAY]]That is at full durability. Repair.Skills.Mastery=Repair Mastery: [[YELLOW]]Extra {0} durability restored Repair.Skills.StackedItems=[[DARK_RED]]You can't repair stacked items. Repair.Skills.Super.Chance=Super Repair Chance: [[YELLOW]]{0} -Repair.Skillup=Repair skill increased by {0}. Total ({1}) Repair.Pretty.Name=Repair #Arcane Forging Repair.Arcane.Chance.Downgrade=[[GRAY]]AF Downgrade Chance: [[YELLOW]]{0}% @@ -397,7 +403,6 @@ Swords.Skills.SS.On=[[GREEN]]**SERRATED STRIKES ACTIVATED** Swords.Skills.SS.Refresh=[[GREEN]]Your [[YELLOW]]Serrated Strikes [[GREEN]]ability is refreshed! Swords.Skills.SS.Other.Off=Serrated Strikes[[GREEN]] has worn off for [[YELLOW]]{0} Swords.Skills.SS.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]Serrated Strikes! -Swords.Skillup=Swords skill increased by {0}. Total ({1}) Swords.SS.Length=Serrated Strikes Length: [[YELLOW]]{0}s #TAMING Taming.Ability.Bonus.0=Environmentally Aware @@ -444,7 +449,6 @@ Taming.SubSkill.Pummel.TargetMessage=You've been knocked back by a wolf! Taming.Listener.Wolf=[[DARK_GRAY]]Your wolf scurries back to you... Taming.Listener=Taming: Taming.SkillName=TAMING -Taming.Skillup=Taming skill increased by {0}. Total ({1}) Taming.Summon.Complete=[[GREEN]]Summoning complete Taming.Summon.Lifespan= (Lifespan: {0}s) Taming.Summon.Fail.Ocelot=You have too many ocelots nearby to summon any more. @@ -482,7 +486,6 @@ Unarmed.Skills.Berserk.On=[[GREEN]]**BERSERK ACTIVATED** Unarmed.Skills.Berserk.Other.Off=Berserk[[GREEN]] has worn off for [[YELLOW]]{0} Unarmed.Skills.Berserk.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]Berserk! Unarmed.Skills.Berserk.Refresh=[[GREEN]]Your [[YELLOW]]Berserk [[GREEN]]ability is refreshed! -Unarmed.Skillup=Unarmed skill increased by {0}. Total ({1}) #WOODCUTTING Woodcutting.Ability.0=Leaf Blower Woodcutting.Ability.1=Blow away leaves @@ -510,7 +513,6 @@ Woodcutting.Skills.TreeFeller.Other.Off=Tree Feller[[GREEN]] has worn off for [[ Woodcutting.Skills.TreeFeller.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]Tree Feller! Woodcutting.Skills.TreeFeller.Splinter=YOUR AXE SPLINTERS INTO DOZENS OF PIECES! Woodcutting.Skills.TreeFeller.Threshold=That tree is too large! -Woodcutting.Skillup=Woodcutting skill increased by {0}. Total ({1}) #ABILITIY #COMBAT @@ -684,7 +686,7 @@ Commands.Description.mmoinfo=Read details about a skill or mechanic. Commands.MmoInfo.Mystery=[[GRAY]]You haven't unlocked this skill yet, but when you do you will be able to read details about it here! Commands.MmoInfo.NoMatch=That subskill doesn't exist! Commands.MmoInfo.Header=[[DARK_AQUA]]-=[]=====[][[GOLD]] MMO Info [[DARK_AQUA]][]=====[]=- -Commands.MmoInfo.SubSkillHeader=[[GOLD]]Name:[[YELLOW]] {0} +Commands.MmoInfo.SubSkillHeader=[[GOLD]]Name:[[YELLOW]] {0} Commands.MmoInfo.DetailsHeader=[[DARK_AQUA]]-=[]=====[][[GREEN]] Details [[DARK_AQUA]][]=====[]=- Commands.MmoInfo.OldSkill=[[GRAY]]mcMMO skills are being converted into an improved modular skill system, unfortunately this skill has not been converted yet and lacks detailed stats. The new system will allow for faster release times for new mcMMO skills and greater flexibility with existing skills. Commands.MmoInfo.Mechanics=[[DARK_AQUA]]-=[]=====[][[GOLD]] Mechanics [[DARK_AQUA]][]=====[]=- @@ -791,6 +793,11 @@ Commands.xprate.over=[[RED]]mcMMO XP Rate Event is OVER!! Commands.xprate.proper.0=[[RED]]Proper usage to change the XP rate is /xprate Commands.xprate.proper.1=[[RED]]Proper usage to restore the XP rate to default is /xprate reset Commands.xprate.proper.2=[[RED]]Please specify true or false to indicate if this is an xp event or not +Commands.NegativeNumberWarn=Don't use negative numbers! +Commands.Event.Start=[[GREEN]]mcMMO[[GOLD]] Event! +Commands.Event.Stop=[[GREEN]]mcMMO[[DARK_AQUA]] Event Over! +Commands.Event.Stop.Subtitle=[[GREEN]]I hope you had fun! +Commands.Event.XP=[[DARK_AQUA]]XP Rate is now [[GOLD]]{0}[[DARK_AQUA]]x Commands.xprate.started.0=[[GOLD]]XP EVENT FOR mcMMO HAS STARTED! Commands.xprate.started.1=[[GOLD]]mcMMO XP RATE IS NOW {0}x! XPRate.Event= [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x!