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)
This commit is contained in:
nossr50 2019-01-28 03:40:32 -08:00
parent 67ed9d324e
commit 00f5491718
6 changed files with 64 additions and 73 deletions

View File

@ -21,6 +21,10 @@ Version 2.1.2
(Skills) Magic Hunter now uses a rank system (Skills) Magic Hunter now uses a rank system
(Skills) Fixed a bug where Magic Hunter would work without treasure hunter (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) 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) 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) (Experience) Wood blocks now give XP and are affected by Tree Feller (6 sided bark blocks)
(API) Moved XPGainReason from skills to experience package (API) Moved XPGainReason from skills to experience package

View File

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

View File

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

View File

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

View File

@ -3,21 +3,13 @@
#DO NOT USE COLOR CODES IN THE JSON KEYS #DO NOT USE COLOR CODES IN THE JSON KEYS
#COLORS ARE DEFINED IN advanced.yml IF YOU WISH TO CHANGE THEM #COLORS ARE DEFINED IN advanced.yml IF YOU WISH TO CHANGE THEM
JSON.Rank=Rank JSON.Rank=Rank
JSON.RankPossesive=of
JSON.DescriptionHeader=Description JSON.DescriptionHeader=Description
JSON.JWrapper.Header=Details JSON.JWrapper.Header=Details
JSON.JWrapper.Activation=Activation:
JSON.JWrapper.Activation.Type.RightClick=Right Click
JSON.Type.Passive=Passive JSON.Type.Passive=Passive
JSON.Type.Active=Active JSON.Type.Active=Active
JSON.Type.SuperAbility=Super Ability JSON.Type.SuperAbility=Super Ability
JSON.SuperAbility.Charges=Charges
JSON.SuperAbility.Duration=Duration
JSON.Locked=-=[LOCKED]=- JSON.Locked=-=[LOCKED]=-
JSON.LevelRequirement=Level Requirement 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.Type=Target Type:
JSON.JWrapper.Target.Block=Block JSON.JWrapper.Target.Block=Block
JSON.JWrapper.Target.Player=Player 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.SkillUnlockMessage=[[GOLD]][ mcMMO[[YELLOW]] @[[DARK_AQUA]]{0} [[GOLD]]Rank [[DARK_AQUA]]{1}[[GOLD]] Unlocked! ]
JSON.Hover.Rank=&e&lRank:&r &f{0} JSON.Hover.Rank=&e&lRank:&r &f{0}
JSON.Hover.NextRank=&7&oNext upgrade at level {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 #This is the message sent to players when an ability is activated
JSON.Notification.SuperAbility={0} JSON.Notification.SuperAbility={0}

View File

@ -8,7 +8,7 @@ Sounds:
Enable: true Enable: true
Volume: 1.0 Volume: 1.0
Pitch: 0.3 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: FIZZ:
Enable: true Enable: true
Volume: 0.5 Volume: 0.5
@ -20,14 +20,10 @@ Sounds:
Enable: true Enable: true
Volume: 1.0 Volume: 1.0
Pitch: 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: POP:
Enable: true Enable: true
Volume: 0.2 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: CHIMAERA_WING:
Enable: true Enable: true
Volume: 1.0 Volume: 1.0