Merge pull request #4231 from Ineusia/issue-4221

Use localized names for SuperAbility names
This commit is contained in:
Robert Alan Chapton 2020-07-25 14:25:36 -07:00 committed by GitHub
commit 81b31e49b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 16 deletions

View File

@ -56,9 +56,9 @@ public class MccooldownCommand implements TabExecutor {
int seconds = mcMMOPlayer.calculateTimeRemaining(ability); int seconds = mcMMOPlayer.calculateTimeRemaining(ability);
if (seconds <= 0) { if (seconds <= 0) {
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.Y", ability.getName())); player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.Y", ability.getLocalizedName()));
} else { } else {
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.N", ability.getName(), seconds)); player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.N", ability.getLocalizedName(), seconds));
} }
} }

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.datatypes.skills; package com.gmail.nossr50.datatypes.skills;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.BlockUtils; import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@ -15,49 +16,56 @@ public enum SuperAbilityType {
"Unarmed.Skills.Berserk.Off", "Unarmed.Skills.Berserk.Off",
"Unarmed.Skills.Berserk.Other.On", "Unarmed.Skills.Berserk.Other.On",
"Unarmed.Skills.Berserk.Refresh", "Unarmed.Skills.Berserk.Refresh",
"Unarmed.Skills.Berserk.Other.Off"), "Unarmed.Skills.Berserk.Other.Off",
"Unarmed.SubSkill.Berserk.Name"),
SUPER_BREAKER( SUPER_BREAKER(
"Mining.Skills.SuperBreaker.On", "Mining.Skills.SuperBreaker.On",
"Mining.Skills.SuperBreaker.Off", "Mining.Skills.SuperBreaker.Off",
"Mining.Skills.SuperBreaker.Other.On", "Mining.Skills.SuperBreaker.Other.On",
"Mining.Skills.SuperBreaker.Refresh", "Mining.Skills.SuperBreaker.Refresh",
"Mining.Skills.SuperBreaker.Other.Off"), "Mining.Skills.SuperBreaker.Other.Off",
"Mining.SubSkill.SuperBreaker.Name"),
GIGA_DRILL_BREAKER( GIGA_DRILL_BREAKER(
"Excavation.Skills.GigaDrillBreaker.On", "Excavation.Skills.GigaDrillBreaker.On",
"Excavation.Skills.GigaDrillBreaker.Off", "Excavation.Skills.GigaDrillBreaker.Off",
"Excavation.Skills.GigaDrillBreaker.Other.On", "Excavation.Skills.GigaDrillBreaker.Other.On",
"Excavation.Skills.GigaDrillBreaker.Refresh", "Excavation.Skills.GigaDrillBreaker.Refresh",
"Excavation.Skills.GigaDrillBreaker.Other.Off"), "Excavation.Skills.GigaDrillBreaker.Other.Off",
"Excavation.SubSkill.GigaDrillBreaker.Name"),
GREEN_TERRA( GREEN_TERRA(
"Herbalism.Skills.GTe.On", "Herbalism.Skills.GTe.On",
"Herbalism.Skills.GTe.Off", "Herbalism.Skills.GTe.Off",
"Herbalism.Skills.GTe.Other.On", "Herbalism.Skills.GTe.Other.On",
"Herbalism.Skills.GTe.Refresh", "Herbalism.Skills.GTe.Refresh",
"Herbalism.Skills.GTe.Other.Off"), "Herbalism.Skills.GTe.Other.Off",
"Herbalism.SubSkill.GreenTerra.Name"),
SKULL_SPLITTER( SKULL_SPLITTER(
"Axes.Skills.SS.On", "Axes.Skills.SS.On",
"Axes.Skills.SS.Off", "Axes.Skills.SS.Off",
"Axes.Skills.SS.Other.On", "Axes.Skills.SS.Other.On",
"Axes.Skills.SS.Refresh", "Axes.Skills.SS.Refresh",
"Axes.Skills.SS.Other.Off"), "Axes.Skills.SS.Other.Off",
"Axes.SubSkill.SkullSplitter.Name"),
TREE_FELLER( TREE_FELLER(
"Woodcutting.Skills.TreeFeller.On", "Woodcutting.Skills.TreeFeller.On",
"Woodcutting.Skills.TreeFeller.Off", "Woodcutting.Skills.TreeFeller.Off",
"Woodcutting.Skills.TreeFeller.Other.On", "Woodcutting.Skills.TreeFeller.Other.On",
"Woodcutting.Skills.TreeFeller.Refresh", "Woodcutting.Skills.TreeFeller.Refresh",
"Woodcutting.Skills.TreeFeller.Other.Off"), "Woodcutting.Skills.TreeFeller.Other.Off",
"Woodcutting.SubSkill.TreeFeller.Name"),
SERRATED_STRIKES( SERRATED_STRIKES(
"Swords.Skills.SS.On", "Swords.Skills.SS.On",
"Swords.Skills.SS.Off", "Swords.Skills.SS.Off",
"Swords.Skills.SS.Other.On", "Swords.Skills.SS.Other.On",
"Swords.Skills.SS.Refresh", "Swords.Skills.SS.Refresh",
"Swords.Skills.SS.Other.Off"), "Swords.Skills.SS.Other.Off",
"Swords.SubSkill.SerratedStrikes.Name"),
/** /**
* Has cooldown - but has to share a skill with Super Breaker, so needs special treatment * Has cooldown - but has to share a skill with Super Breaker, so needs special treatment
@ -67,7 +75,8 @@ public enum SuperAbilityType {
null, null,
"Mining.Blast.Other.On", "Mining.Blast.Other.On",
"Mining.Blast.Refresh", "Mining.Blast.Refresh",
null), null,
"Mining.SubSkill.BlastMining.Name"),
; ;
/* /*
@ -91,13 +100,15 @@ public enum SuperAbilityType {
private final String abilityRefresh; private final String abilityRefresh;
private final String abilityPlayerOff; private final String abilityPlayerOff;
private SubSkillType subSkillTypeDefinition; private SubSkillType subSkillTypeDefinition;
private final String localizedName;
SuperAbilityType(String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) { SuperAbilityType(String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff, String localizedName) {
this.abilityOn = abilityOn; this.abilityOn = abilityOn;
this.abilityOff = abilityOff; this.abilityOff = abilityOff;
this.abilityPlayer = abilityPlayer; this.abilityPlayer = abilityPlayer;
this.abilityRefresh = abilityRefresh; this.abilityRefresh = abilityRefresh;
this.abilityPlayerOff = abilityPlayerOff; this.abilityPlayerOff = abilityPlayerOff;
this.localizedName = localizedName;
} }
public int getCooldown() { public int getCooldown() {
@ -132,6 +143,10 @@ public enum SuperAbilityType {
return StringUtils.getPrettyAbilityString(this); return StringUtils.getPrettyAbilityString(this);
} }
public String getLocalizedName() {
return LocaleLoader.getString(localizedName);
}
@Override @Override
public String toString() { public String toString() {
String baseString = name(); String baseString = name();

View File

@ -90,10 +90,10 @@ public class ScoreboardManager {
skillLabelBuilder.put(type, getShortenedName(colors.get(i) + type.getName(), false)); skillLabelBuilder.put(type, getShortenedName(colors.get(i) + type.getName(), false));
if (type.getAbility() != null) { if (type.getAbility() != null) {
abilityLabelBuilder.put(type.getAbility(), getShortenedName(colors.get(i) + type.getAbility().getName())); abilityLabelBuilder.put(type.getAbility(), getShortenedName(colors.get(i) + type.getAbility().getLocalizedName()));
if (type == PrimarySkillType.MINING) { if (type == PrimarySkillType.MINING) {
abilityLabelBuilder.put(SuperAbilityType.BLAST_MINING, getShortenedName(colors.get(i) + SuperAbilityType.BLAST_MINING.getName())); abilityLabelBuilder.put(SuperAbilityType.BLAST_MINING, getShortenedName(colors.get(i) + SuperAbilityType.BLAST_MINING.getLocalizedName()));
} }
} }
@ -112,17 +112,17 @@ public class ScoreboardManager {
skillLabelBuilder.put(type, getShortenedName(ChatColor.GREEN + type.getName())); skillLabelBuilder.put(type, getShortenedName(ChatColor.GREEN + type.getName()));
if (type.getAbility() != null) { if (type.getAbility() != null) {
abilityLabelBuilder.put(type.getAbility(), formatAbility(type.getAbility().getName())); abilityLabelBuilder.put(type.getAbility(), formatAbility(type.getAbility().getLocalizedName()));
if (type == PrimarySkillType.MINING) { if (type == PrimarySkillType.MINING) {
abilityLabelBuilder.put(SuperAbilityType.BLAST_MINING, formatAbility(SuperAbilityType.BLAST_MINING.getName())); abilityLabelBuilder.put(SuperAbilityType.BLAST_MINING, formatAbility(SuperAbilityType.BLAST_MINING.getLocalizedName()));
} }
} }
} }
} }
for (SuperAbilityType type : SuperAbilityType.values()) { for (SuperAbilityType type : SuperAbilityType.values()) {
abilityLabelSkillBuilder.put(type, formatAbility((type == SuperAbilityType.BLAST_MINING ? ChatColor.BLUE : ChatColor.AQUA), type.getName())); abilityLabelSkillBuilder.put(type, formatAbility((type == SuperAbilityType.BLAST_MINING ? ChatColor.BLUE : ChatColor.AQUA), type.getLocalizedName()));
} }
skillLabels = skillLabelBuilder.build(); skillLabels = skillLabelBuilder.build();