diff --git a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java index 70c4e2c8e..72f6acf30 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.List; import org.bukkit.Location; -import org.bukkit.block.Biome; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; diff --git a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java index 477035fa6..beab4b3ea 100644 --- a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java +++ b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java @@ -40,21 +40,21 @@ public class ScoreboardManager { static final String POWER_LEVEL = LocaleLoader.getString("Scoreboard.Misc.PowerLevel"); - static final OfflinePlayer LABEL_POWER_LEVEL = getOfflinePlayer(POWER_LEVEL); - static final OfflinePlayer LABEL_LEVEL = getOfflinePlayer(LocaleLoader.getString("Scoreboard.Misc.Level")); - static final OfflinePlayer LABEL_CURRENT_XP = getOfflinePlayer(LocaleLoader.getString("Scoreboard.Misc.CurrentXP")); - static final OfflinePlayer LABEL_REMAINING_XP = getOfflinePlayer(LocaleLoader.getString("Scoreboard.Misc.RemainingXP")); - static final OfflinePlayer LABEL_ABILITY_COOLDOWN = getOfflinePlayer(LocaleLoader.getString("Scoreboard.Misc.Cooldown")); - static final OfflinePlayer LABEL_OVERALL = getOfflinePlayer(LocaleLoader.getString("Scoreboard.Misc.Overall")); + static final String LABEL_POWER_LEVEL = POWER_LEVEL; + static final String LABEL_LEVEL = LocaleLoader.getString("Scoreboard.Misc.Level"); + static final String LABEL_CURRENT_XP = LocaleLoader.getString("Scoreboard.Misc.CurrentXP"); + static final String LABEL_REMAINING_XP = LocaleLoader.getString("Scoreboard.Misc.RemainingXP"); + static final String LABEL_ABILITY_COOLDOWN = LocaleLoader.getString("Scoreboard.Misc.Cooldown"); + static final String LABEL_OVERALL = LocaleLoader.getString("Scoreboard.Misc.Overall"); - static final Map skillLabels; - static final Map abilityLabelsColored; - static final Map abilityLabelsSkill; + static final Map skillLabels; + static final Map abilityLabelsColored; + static final Map abilityLabelsSkill; static { - ImmutableMap.Builder skillLabelBuilder = ImmutableMap.builder(); - ImmutableMap.Builder abilityLabelBuilder = ImmutableMap.builder(); - ImmutableMap.Builder abilityLabelSkillBuilder = ImmutableMap.builder(); + ImmutableMap.Builder skillLabelBuilder = ImmutableMap.builder(); + ImmutableMap.Builder abilityLabelBuilder = ImmutableMap.builder(); + ImmutableMap.Builder abilityLabelSkillBuilder = ImmutableMap.builder(); if (Config.getInstance().getScoreboardRainbows()) { // Everything but black, gray, gold @@ -78,13 +78,13 @@ public class ScoreboardManager { int i = 0; for (SkillType type : SkillType.values()) { // Include child skills - skillLabelBuilder.put(type, getOfflinePlayer(colors.get(i) + type.getName())); + skillLabelBuilder.put(type, colors.get(i) + type.getName()); if (type.getAbility() != null) { - abilityLabelBuilder.put(type.getAbility(), getOfflinePlayer(colors.get(i) + type.getAbility().getName())); + abilityLabelBuilder.put(type.getAbility(),colors.get(i) + type.getAbility().getName()); if (type == SkillType.MINING) { - abilityLabelBuilder.put(AbilityType.BLAST_MINING, getOfflinePlayer(colors.get(i) + AbilityType.BLAST_MINING.getName())); + abilityLabelBuilder.put(AbilityType.BLAST_MINING, colors.get(i) + AbilityType.BLAST_MINING.getName()); } } @@ -94,20 +94,20 @@ public class ScoreboardManager { else { for (SkillType type : SkillType.values()) { // Include child skills - skillLabelBuilder.put(type, getOfflinePlayer(ChatColor.GREEN + type.getName())); + skillLabelBuilder.put(type, ChatColor.GREEN + type.getName()); if (type.getAbility() != null) { - abilityLabelBuilder.put(type.getAbility(), getOfflinePlayerDots(ChatColor.AQUA + type.getAbility().getName())); + abilityLabelBuilder.put(type.getAbility(), ChatColor.AQUA + type.getAbility().getName()); if (type == SkillType.MINING) { - abilityLabelBuilder.put(AbilityType.BLAST_MINING, getOfflinePlayerDots(ChatColor.AQUA + AbilityType.BLAST_MINING.getName())); + abilityLabelBuilder.put(AbilityType.BLAST_MINING, ChatColor.AQUA + AbilityType.BLAST_MINING.getName()); } } } } for (AbilityType type : AbilityType.values()) { - abilityLabelSkillBuilder.put(type, getOfflinePlayerDots((type == AbilityType.BLAST_MINING ? ChatColor.BLUE : ChatColor.AQUA) + type.getName())); + abilityLabelSkillBuilder.put(type, (type == AbilityType.BLAST_MINING ? ChatColor.BLUE : ChatColor.AQUA) + type.getName()); } skillLabels = skillLabelBuilder.build(); @@ -117,22 +117,6 @@ public class ScoreboardManager { private static List dirtyPowerLevels = new ArrayList(); - private static OfflinePlayer getOfflinePlayer(String name) { - return getOfflinePlayer(name, false); - } - - private static OfflinePlayer getOfflinePlayerDots(String name) { - return getOfflinePlayer(name, true); - } - - private static OfflinePlayer getOfflinePlayer(String name, boolean useDots) { - if (name.length() > 16) { - name = useDots ? name.substring(0, 14) + ".." : name.substring(0, 16); - } - - return mcMMO.p.getServer().getOfflinePlayer(name); - } - public enum SidebarType { NONE, SKILL_BOARD, @@ -338,7 +322,7 @@ public class ScoreboardManager { Player player = mcMMOPlayer.getPlayer(); int power = mcMMOPlayer.getPowerLevel(); - mainObjective.getScore(player).setScore(power); + mainObjective.getScore(playerName).setScore(power); for (ScoreboardWrapper wrapper : PLAYER_SCOREBOARDS.values()) { wrapper.updatePowerLevel(player, power); diff --git a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java index 7c39d066b..8967836f7 100644 --- a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java +++ b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java @@ -59,7 +59,7 @@ public class ScoreboardWrapper { powerObjective.setDisplaySlot(DisplaySlot.BELOW_NAME); for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) { - powerObjective.getScore(mcMMOPlayer.getPlayer()).setScore(mcMMOPlayer.getPowerLevel()); + powerObjective.getScore(mcMMOPlayer.getProfile().getPlayerName()).setScore(mcMMOPlayer.getPowerLevel()); } } } @@ -274,7 +274,7 @@ public class ScoreboardWrapper { targetProfile = null; leaderboardPage = -1; - loadObjective(ScoreboardManager.skillLabels.get(skill).getName()); + loadObjective(ScoreboardManager.skillLabels.get(skill)); } public void setTypeSelfStats() { @@ -355,7 +355,7 @@ public class ScoreboardWrapper { int endPosition = page * 15; int startPosition = endPosition - 14; - loadObjective(String.format("%s (%2d - %2d)", ScoreboardManager.skillLabels.get(skill).getName(), startPosition, endPosition)); + loadObjective(String.format("%s (%2d - %2d)", ScoreboardManager.skillLabels.get(skill), startPosition, endPosition)); } // Setup for after a board type change @@ -551,11 +551,11 @@ public class ScoreboardWrapper { name = ChatColor.GOLD + "--You--"; } - sidebarObjective.getScore(mcMMO.p.getServer().getOfflinePlayer(name)).setScore(stat.statVal); + sidebarObjective.getScore(name).setScore(stat.statVal); } } public void updatePowerLevel(Player player, int newPowerLevel) { - powerObjective.getScore(player).setScore(newPowerLevel); + powerObjective.getScore(player.getName()).setScore(newPowerLevel); } }