소스 검색

Added many styling options
Improved Smelting Style
You can now add the level required to a skills name in the locale (instructions can be found next to the locale string)

nossr50 6 년 전
부모
커밋
00f5491718

+ 4 - 0
Changelog.txt

@@ -21,6 +21,10 @@ Version 2.1.2
     (Skills) Magic Hunter now uses a rank system
     (Skills) Fixed a bug where Magic Hunter would work without treasure hunter
     (Skills) As long are you are empty handed mcMMO will no longer put items into your hands
+    (Skills) Improved the styling on /smelting
+    (Style) Locked skills now are styled differently in the skill command display
+    (Style) Added @ symbol styling for hover tooltips to the locale
+    (Style) Added the skill names in the skill commands display to the locale so it can now be edited and styled
     (Experience) Renamed Grass to Grass_Block in treasures.yml to allow grass to give items again (update your configs manually or delete to regen)
     (Experience) Wood blocks now give XP and are affected by Tree Feller (6 sided bark blocks)
     (API) Moved XPGainReason from skills to experience package

+ 50 - 53
src/main/java/com/gmail/nossr50/util/TextComponentFactory.java

@@ -124,8 +124,7 @@ public class TextComponentFactory {
             //Style the skills into @links
             final String originalTxt = textComponent.getText();
 
-            TextComponent stylizedText = new TextComponent("@");
-            stylizedText.setColor(ChatColor.YELLOW);
+            TextComponent stylizedText = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolSkills"));
             addChild(stylizedText, originalTxt);
 
             if(textComponent.getHoverEvent() != null)
@@ -156,38 +155,32 @@ public class TextComponentFactory {
         switch(webLinks)
         {
             case WEBSITE:
-                webTextComponent = new TextComponent("@");
-                webTextComponent.setColor(ChatColor.YELLOW);
+                webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
                 addChild(webTextComponent, "Web");
                 webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlWebsite));
                 break;
             case SPIGOT:
-                webTextComponent = new TextComponent("@");
-                webTextComponent.setColor(ChatColor.YELLOW);
+                webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
                 addChild(webTextComponent, "Spigot");
                 webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlSpigot));
                 break;
             case DISCORD:
-                webTextComponent = new TextComponent("@");
-                webTextComponent.setColor(ChatColor.YELLOW);
+                webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
                 addChild(webTextComponent, "Discord");
                 webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlDiscord));
                 break;
             case PATREON:
-                webTextComponent = new TextComponent("@");
-                webTextComponent.setColor(ChatColor.YELLOW);
+                webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
                 addChild(webTextComponent, "Patreon");
                 webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlPatreon));
                 break;
             case WIKI:
-                webTextComponent = new TextComponent("@");
-                webTextComponent.setColor(ChatColor.YELLOW);
+                webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
                 addChild(webTextComponent, "Wiki");
                 webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlWiki));
                 break;
             case HELP_TRANSLATE:
-                webTextComponent = new TextComponent("@");
-                webTextComponent.setColor(ChatColor.YELLOW);
+                webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
                 addChild(webTextComponent, "Lang");
                 webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlTranslate));
                 break;
@@ -270,20 +263,10 @@ public class TextComponentFactory {
     {
         //Get skill name
         String skillName = subSkillType.getLocaleName();
-        TextComponent textComponent;
 
-        //Setup Text Component
-        if(RankUtils.hasUnlockedSubskill(player, subSkillType))
-        {
-            textComponent = new TextComponent(skillName);
-            textComponent.setColor(ChatColor.DARK_AQUA);
-            textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/mmoinfo "+subSkillType.getNiceNameNoSpaces(subSkillType)));
-        }
-        else {
-            textComponent = new TextComponent("???");
-            textComponent.setColor(ChatColor.DARK_GRAY);
-            textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/mmoinfo ???"));
-        }
+        boolean skillUnlocked = RankUtils.hasUnlockedSubskill(player, subSkillType);
+
+        TextComponent textComponent = initNewSkillTextComponent(player, skillName, subSkillType, skillUnlocked);
 
         //Hover Event
         addNewHoverComponentToTextComponent(textComponent, getSubSkillHoverComponent(player, subSkillType));
@@ -304,20 +287,11 @@ public class TextComponentFactory {
         String skillName = abstractSubSkill.getNiceName();
 
         //Setup Text Component
-        TextComponent textComponent;
+        SubSkillType subSkillType = abstractSubSkill.getSubSkillType();
 
-        //Setup Text Component
-        if(RankUtils.hasUnlockedSubskill(player, abstractSubSkill))
-        {
-            textComponent = new TextComponent(skillName);
-            textComponent.setColor(ChatColor.DARK_AQUA);
-            textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/mmoinfo "+abstractSubSkill.getConfigKeyName()));
-        }
-        else {
-            textComponent = new TextComponent("???");
-            textComponent.setColor(ChatColor.DARK_GRAY);
-            textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/mmoinfo ???"));
-        }
+        boolean skillUnlocked = RankUtils.hasUnlockedSubskill(player, subSkillType);
+
+        TextComponent textComponent = initNewSkillTextComponent(player, skillName, subSkillType, skillUnlocked);
 
         //Hover Event
         addNewHoverComponentToTextComponent(textComponent, getSubSkillHoverComponent(player, abstractSubSkill));
@@ -328,6 +302,25 @@ public class TextComponentFactory {
         return textComponent;
     }
 
+    private static TextComponent initNewSkillTextComponent(Player player, String skillName, SubSkillType subSkillType, boolean skillUnlocked) {
+        TextComponent textComponent;
+        if (skillUnlocked) {
+            if (RankUtils.getHighestRank(subSkillType) == RankUtils.getRank(player, subSkillType) && subSkillType.getNumRanks() > 1)
+                textComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.MaxRankSkillName", skillName));
+            else
+                textComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.SkillName", skillName));
+
+            textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/mmoinfo " + subSkillType.getNiceNameNoSpaces(subSkillType)));
+
+        } else {
+            textComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.Mystery",
+                    String.valueOf(RankUtils.getUnlockLevel(subSkillType))));
+
+            textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/mmoinfo ???"));
+        }
+        return textComponent;
+    }
+
     private static BaseComponent[] getSubSkillHoverComponent(Player player, AbstractSubSkill abstractSubSkill)
     {
         return getSubSkillHoverEventJSON(abstractSubSkill, player);
@@ -362,13 +355,10 @@ public class TextComponentFactory {
         ChatColor ccLevelRequirement    = ChatColor.BLUE;
         ChatColor ccLevelRequired       = ChatColor.RED;
 
-        ComponentBuilder componentBuilder;
+        SubSkillType subSkillType = abstractSubSkill.getSubSkillType();
 
         //SubSkillType Name
-        if(RankUtils.hasUnlockedSubskill(player, abstractSubSkill))
-            componentBuilder = getNewComponentBuilder(skillName, ccSubSkillHeader);
-        else
-            componentBuilder = getNewComponentBuilder("???", ccSubSkillHeader);
+        ComponentBuilder componentBuilder = setupSkillComponentNameStyle(player, skillName, subSkillType, RankUtils.hasUnlockedSubskill(player, abstractSubSkill));
 
         if(!RankUtils.hasUnlockedSubskill(player, abstractSubSkill))
         {
@@ -402,9 +392,21 @@ public class TextComponentFactory {
         return componentBuilder.create();
     }
 
-    private static ComponentBuilder getNewComponentBuilder(String skillName, ChatColor ccSubSkillHeader) {
+    private static ComponentBuilder setupSkillComponentNameStyle(Player player, String skillName, SubSkillType subSkillType, boolean skillUnlocked) {
+        ComponentBuilder componentBuilder;
+        if (skillUnlocked) {
+            if (RankUtils.getHighestRank(subSkillType) == RankUtils.getRank(player, subSkillType) && subSkillType.getNumRanks() > 1)
+                componentBuilder = getNewComponentBuilder(LocaleLoader.getString("JSON.Hover.MaxRankSkillName", skillName));
+            else
+                componentBuilder = getNewComponentBuilder(LocaleLoader.getString("JSON.Hover.SkillName", skillName));
+        } else
+            componentBuilder = getNewComponentBuilder(LocaleLoader.getString("JSON.Hover.Mystery",
+                    String.valueOf(RankUtils.getUnlockLevel(subSkillType))));
+        return componentBuilder;
+    }
+
+    private static ComponentBuilder getNewComponentBuilder(String skillName) {
         ComponentBuilder componentBuilder = new ComponentBuilder(skillName);
-        componentBuilder.bold(true).color(ccSubSkillHeader);
         componentBuilder.append("\n");
         return componentBuilder;
     }
@@ -462,13 +464,8 @@ public class TextComponentFactory {
         ChatColor ccLevelRequirement    = ChatColor.BLUE;
         ChatColor ccLevelRequired       = ChatColor.RED;
 
-        ComponentBuilder componentBuilder;
-
         //SubSkillType Name
-        if(RankUtils.hasUnlockedSubskill(player, subSkillType))
-            componentBuilder = getNewComponentBuilder(skillName, ccSubSkillHeader);
-        else
-            componentBuilder = getNewComponentBuilder("???", ccSubSkillHeader);
+        ComponentBuilder componentBuilder = setupSkillComponentNameStyle(player, skillName, subSkillType, RankUtils.hasUnlockedSubskill(player, subSkillType));
 
         if(!RankUtils.hasUnlockedSubskill(player, subSkillType))
         {

+ 0 - 4
src/main/java/com/gmail/nossr50/util/sounds/SoundManager.java

@@ -55,8 +55,6 @@ public class SoundManager {
             return getFizzPitch();
         else if (soundType == SoundType.POP)
             return getPopPitch();
-        else if (soundType == SoundType.KRAKEN)
-            return getKrakenPitch();
         else
             return SoundConfig.getInstance().getPitch(soundType);
     }
@@ -71,8 +69,6 @@ public class SoundManager {
                 return Sound.ENTITY_ITEM_BREAK;
             case POP:
                 return Sound.ENTITY_ITEM_PICKUP;
-            case KRAKEN:
-                return Sound.ENTITY_GHAST_SCREAM;
             case CHIMAERA_WING:
                 return Sound.ENTITY_BAT_TAKEOFF;
             case LEVEL_UP:

+ 0 - 2
src/main/java/com/gmail/nossr50/util/sounds/SoundType.java

@@ -6,7 +6,6 @@ public enum SoundType {
     FIZZ,
     ITEM_BREAK,
     POP,
-    KRAKEN,
     CHIMAERA_WING,
     ROLL_ACTIVATED,
     SKILL_UNLOCKED,
@@ -22,7 +21,6 @@ public enum SoundType {
         switch(this){
             case POP:
             case FIZZ:
-            case KRAKEN:
                 return true;
             default:
                 return false;

+ 8 - 8
src/main/resources/locale/locale_en_US.properties

@@ -3,21 +3,13 @@
 #DO NOT USE COLOR CODES IN THE JSON KEYS
 #COLORS ARE DEFINED IN advanced.yml IF YOU WISH TO CHANGE THEM
 JSON.Rank=Rank
-JSON.RankPossesive=of
 JSON.DescriptionHeader=Description
 JSON.JWrapper.Header=Details
-JSON.JWrapper.Activation=Activation:
-JSON.JWrapper.Activation.Type.RightClick=Right Click
 JSON.Type.Passive=Passive
 JSON.Type.Active=Active
 JSON.Type.SuperAbility=Super Ability
-JSON.SuperAbility.Charges=Charges
-JSON.SuperAbility.Duration=Duration
 JSON.Locked=-=[LOCKED]=-
 JSON.LevelRequirement=Level Requirement
-JSON.JWrapper.Random.ActivationChance=Activation Chance:
-JSON.JWrapper.Random.MaxChance=Max Bonus:
-JSON.JWrapper.Duration=Duration:
 JSON.JWrapper.Target.Type=Target Type:
 JSON.JWrapper.Target.Block=Block
 JSON.JWrapper.Target.Player=Player
@@ -47,6 +39,14 @@ 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}
+# for JSON.Hover.Mystery you can add {0} to insert the level required into the name, I don't like how that looks so I'm not doing that atm
+JSON.Hover.Mystery=[[GRAY]]???
+JSON.Hover.Mystery2=[[YELLOW]][[[DARK_GRAY]]{0}[[YELLOW]]][[DARK_GRAY]]???&r
+JSON.Hover.SkillName=[[DARK_AQUA]]{0}&r
+JSON.Hover.SuperAbility=[[DARK_PURPLE]]{0}&r
+JSON.Hover.MaxRankSkillName=[[GOLD]]{0}&r
+JSON.Hover.AtSymbolSkills=[[YELLOW]]@
+JSON.Hover.AtSymbolURL=[[YELLOW]]@
 
 #This is the message sent to players when an ability is activated
 JSON.Notification.SuperAbility={0}

+ 2 - 6
src/main/resources/sounds.yml

@@ -8,7 +8,7 @@ Sounds:
         Enable: true
         Volume: 1.0
         Pitch: 0.3
-    #Fizz, Pop, and Kraken make use of a adding and multiplying random numbers together to make a unique pitch everytime they are heard
+    #Fizz, and Pop make use of a adding and multiplying random numbers together to make a unique pitch everytime they are heard
     FIZZ:
         Enable: true
         Volume: 0.5
@@ -20,14 +20,10 @@ Sounds:
         Enable: true
         Volume: 1.0
         Pitch: 1.0
-    #Fizz, Pop, and Kraken make use of a adding and multiplying random numbers together to make a unique pitch everytime they are heard
+    #Fizz, and Pop make use of a adding and multiplying random numbers together to make a unique pitch everytime they are heard
     POP:
         Enable: true
         Volume: 0.2
-    #Fizz, Pop, and Kraken make use of a adding and multiplying random numbers together to make a unique pitch everytime they are heard
-    KRAKEN:
-        Enable: true
-        Volume: 1.0
     CHIMAERA_WING:
         Enable: true
         Volume: 1.0