mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Make sure to shorten long ability and skill names
(cherry picked from commit 236ccd6ebdd0834f87b373794e1597ef36fb2ff6)
This commit is contained in:
parent
bfebbd0095
commit
5825eb1696
@ -77,13 +77,13 @@ public class ScoreboardManager {
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
for (SkillType type : SkillType.values()) {
|
for (SkillType type : SkillType.values()) {
|
||||||
// Include child skills
|
// Include child skills
|
||||||
skillLabelBuilder.put(type, colors.get(i) + type.getName());
|
skillLabelBuilder.put(type, getShortenedName(colors.get(i) + type.getName(), false));
|
||||||
|
|
||||||
if (type.getAbility() != null) {
|
if (type.getAbility() != null) {
|
||||||
abilityLabelBuilder.put(type.getAbility(), colors.get(i) + type.getAbility().getName());
|
abilityLabelBuilder.put(type.getAbility(), getShortenedName(colors.get(i) + type.getAbility().getName()));
|
||||||
|
|
||||||
if (type == SkillType.MINING) {
|
if (type == SkillType.MINING) {
|
||||||
abilityLabelBuilder.put(AbilityType.BLAST_MINING, colors.get(i) + AbilityType.BLAST_MINING.getName());
|
abilityLabelBuilder.put(AbilityType.BLAST_MINING, getShortenedName(colors.get(i) + AbilityType.BLAST_MINING.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,20 +95,20 @@ public class ScoreboardManager {
|
|||||||
else {
|
else {
|
||||||
for (SkillType type : SkillType.values()) {
|
for (SkillType type : SkillType.values()) {
|
||||||
// Include child skills
|
// Include child skills
|
||||||
skillLabelBuilder.put(type, ChatColor.GREEN + type.getName());
|
skillLabelBuilder.put(type, getShortenedName(ChatColor.GREEN + type.getName()));
|
||||||
|
|
||||||
if (type.getAbility() != null) {
|
if (type.getAbility() != null) {
|
||||||
abilityLabelBuilder.put(type.getAbility(), ChatColor.AQUA + type.getAbility().getName());
|
abilityLabelBuilder.put(type.getAbility(), getShortenedName(ChatColor.AQUA + type.getAbility().getName()));
|
||||||
|
|
||||||
if (type == SkillType.MINING) {
|
if (type == SkillType.MINING) {
|
||||||
abilityLabelBuilder.put(AbilityType.BLAST_MINING, ChatColor.AQUA + AbilityType.BLAST_MINING.getName());
|
abilityLabelBuilder.put(AbilityType.BLAST_MINING, getShortenedName(ChatColor.AQUA + AbilityType.BLAST_MINING.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (AbilityType type : AbilityType.values()) {
|
for (AbilityType type : AbilityType.values()) {
|
||||||
abilityLabelSkillBuilder.put(type, (type == AbilityType.BLAST_MINING ? ChatColor.BLUE : ChatColor.AQUA) + type.getName());
|
abilityLabelSkillBuilder.put(type, getShortenedName((type == AbilityType.BLAST_MINING ? ChatColor.BLUE : ChatColor.AQUA) + type.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
skillLabels = skillLabelBuilder.build();
|
skillLabels = skillLabelBuilder.build();
|
||||||
@ -127,6 +127,18 @@ public class ScoreboardManager {
|
|||||||
TOP_BOARD;
|
TOP_BOARD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getShortenedName(String name) {
|
||||||
|
return getShortenedName(name, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getShortenedName(String name, boolean useDots) {
|
||||||
|
if (name.length() > 16) {
|
||||||
|
name = useDots ? name.substring(0, 14) + ".." : name.substring(0, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
// **** Listener call-ins **** //
|
// **** Listener call-ins **** //
|
||||||
|
|
||||||
// Called by PlayerJoinEvent listener
|
// Called by PlayerJoinEvent listener
|
||||||
|
Loading…
Reference in New Issue
Block a user