Prechádzať zdrojové kódy

Players need to have unique objectives

nossr50 6 rokov pred
rodič
commit
f11b98c29d

+ 3 - 0
Changelog.txt

@@ -15,6 +15,9 @@ Version 2.1.0
  + Added links to mcMMO related websites to various commands
  + Certain elements of mcMMO's UI have been restyled
  + Added the tagline "Overhaul Era" to various locations until 3.0.0 comes out
+ + (Skills) Tool alerts now are sent to the Action Bar
+ + (Skills) Super Ability activation alerts are now sent to the Action Bar
+ + (Skills) Certain Skill messages are now sent to the Action Bar
  + (Config) Added option to disable the new URL links to config.yml
  + (Config) New config file added coreskills.yml
  + (Config) Added rank settings for the new Woodcutting skill

+ 12 - 3
src/main/java/com/gmail/nossr50/config/AdvancedConfig.java

@@ -711,7 +711,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
             case SUBSKILL_UNLOCKED:
                 key = "SubSkillUnlocked";
                 break;
-            case TOOL_READY:
+            case TOOL:
                 key = "ToolReady";
                 break;
             case SUPER_ABILITY:
@@ -781,16 +781,25 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
         return config.getBoolean("Style.JSON.Hover.Details.Description.Underlined");
     }
 
+    public ChatColor getJSONActionBarColor(NotificationType notificationType)
+    {
+        return getChatColor(LocaleLoader.getString("Style.JSON.Notification."+notificationType.toString()+".Color"));
+    }
+
     private ChatColor getChatColorFromKey(String keyLocation) {
         String colorName = LocaleLoader.getString(keyLocation);
 
+        return getChatColor(colorName);
+    }
+
+    private ChatColor getChatColor(String configColor) {
         for (ChatColor chatColor : ChatColor.values()) {
-            if (colorName.equalsIgnoreCase(chatColor.toString()))
+            if (configColor.equalsIgnoreCase(chatColor.getName()))
                 return chatColor;
         }
 
         //Invalid Color
-        System.out.println("[mcMMO] " + colorName + " is an invalid color value for key " + keyLocation);
+        System.out.println("[mcMMO] " + configColor + " is an invalid color value");
         return ChatColor.WHITE;
     }
 

+ 20 - 7
src/main/java/com/gmail/nossr50/datatypes/interactions/NotificationType.java

@@ -4,10 +4,23 @@ package com.gmail.nossr50.datatypes.interactions;
  * This class helps define the types of information interactions we will have with players
  */
 public enum NotificationType {
-    XP_GAIN,
-    SUBSKILL_UNLOCKED,
-    LEVEL_UP_MESSAGE,
-    SUBSKILL_MESSAGE,
-    TOOL_READY,
-    SUPER_ABILITY
-}
+    XP_GAIN("ExperienceGain"),
+    SUBSKILL_UNLOCKED("SubSkillUnlocked"),
+    LEVEL_UP_MESSAGE("LevelUps"),
+    SUBSKILL_MESSAGE("SubSkillInteraction"),
+    TOOL("ToolReady"),
+    UNSKILLED("LevelRequirementNotMet"),
+    ABILITY_COOLDOWN("AbilityCoolDown"),
+    SUPER_ABILITY("SuperAbilityInteraction");
+
+    final String niceName;
+
+    NotificationType(String niceName)
+    {
+        this.niceName = niceName;
+    }
+
+    @Override
+    public String toString() {
+        return niceName;
+    }}

+ 8 - 7
src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java

@@ -4,6 +4,7 @@ import com.gmail.nossr50.config.AdvancedConfig;
 import com.gmail.nossr50.config.Config;
 import com.gmail.nossr50.config.experience.ExperienceConfig;
 import com.gmail.nossr50.datatypes.chat.ChatMode;
+import com.gmail.nossr50.datatypes.interactions.NotificationType;
 import com.gmail.nossr50.datatypes.mods.CustomTool;
 import com.gmail.nossr50.datatypes.party.Party;
 import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
@@ -11,6 +12,7 @@ import com.gmail.nossr50.datatypes.skills.SuperAbility;
 import com.gmail.nossr50.datatypes.skills.PrimarySkill;
 import com.gmail.nossr50.datatypes.skills.ToolType;
 import com.gmail.nossr50.datatypes.skills.XPGainReason;
+import com.gmail.nossr50.listeners.InteractionManager;
 import com.gmail.nossr50.locale.LocaleLoader;
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.party.PartyManager;
@@ -38,7 +40,6 @@ import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
 import com.gmail.nossr50.util.EventUtils;
 import com.gmail.nossr50.util.Misc;
 import com.gmail.nossr50.util.Permissions;
-import com.gmail.nossr50.util.StringUtils;
 import com.gmail.nossr50.util.player.UserManager;
 import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
 import com.gmail.nossr50.util.skills.ParticleEffectUtils;
@@ -514,7 +515,8 @@ public class McMMOPlayer {
             player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, Misc.LEVELUP_VOLUME, Misc.LEVELUP_PITCH);
         }
 
-        player.sendMessage(LocaleLoader.getString(StringUtils.getCapitalized(primarySkill.toString()) + ".Skillup", levelsGained, getSkillLevel(primarySkill)));
+        InteractionManager.sendPlayerLevelUpNotification(UserManager.getPlayer(player), primarySkill, profile.getSkillLevel(primarySkill));
+        //player.sendMessage(LocaleLoader.getString(StringUtils.getCapitalized(primarySkill.toString()) + ".Skillup", levelsGained, getSkillLevel(primarySkill)));
     }
 
     /*
@@ -729,8 +731,6 @@ public class McMMOPlayer {
         ToolType tool = skill.getTool();
         SuperAbility ability = skill.getAbility();
 
-        setToolPreparationMode(tool, false);
-
         if (getAbilityMode(ability)) {
             return;
         }
@@ -785,6 +785,7 @@ public class McMMOPlayer {
             SkillUtils.handleAbilitySpeedIncrease(player);
         }
 
+        setToolPreparationMode(tool, false);
         new AbilityDisableTask(this, ability).runTaskLater(mcMMO.p, ticks * Misc.TICK_CONVERSION_FACTOR);
     }
 
@@ -811,6 +812,7 @@ public class McMMOPlayer {
 
         SuperAbility ability = skill.getAbility();
         ToolType tool = skill.getTool();
+        setToolPreparationMode(tool, true);
 
         /*
          * Woodcutting & Axes need to be treated differently.
@@ -821,16 +823,15 @@ public class McMMOPlayer {
                 int timeRemaining = calculateTimeRemaining(ability);
 
                 if (!getAbilityMode(ability) && timeRemaining > 0) {
-                    player.sendMessage(LocaleLoader.getString("Skills.TooTired", timeRemaining));
+                    InteractionManager.sendPlayerInformation(player, NotificationType.ABILITY_COOLDOWN, "Skills.TooTired", String.valueOf(timeRemaining));
                     return;
                 }
             }
 
             if (Config.getInstance().getAbilityMessagesEnabled()) {
-                player.sendMessage(tool.getRaiseTool());
+                InteractionManager.sendPlayerInformation(player, NotificationType.TOOL, tool.getRaiseTool());
             }
 
-            setToolPreparationMode(tool, true);
             new ToolLowerTask(this, tool).runTaskLaterAsynchronously(mcMMO.p, 4 * Misc.TICK_CONVERSION_FACTOR);
         }
     }

+ 6 - 6
src/main/java/com/gmail/nossr50/datatypes/skills/ToolType.java

@@ -7,12 +7,12 @@ import com.gmail.nossr50.locale.LocaleLoader;
 import com.gmail.nossr50.util.ItemUtils;
 
 public enum ToolType {
-    AXE(LocaleLoader.getString("Axes.Ability.Lower"), LocaleLoader.getString("Axes.Ability.Ready")),
-    FISTS(LocaleLoader.getString("Unarmed.Ability.Lower"), LocaleLoader.getString("Unarmed.Ability.Ready")),
-    HOE(LocaleLoader.getString("Herbalism.Ability.Lower"), LocaleLoader.getString("Herbalism.Ability.Ready")),
-    PICKAXE(LocaleLoader.getString("Mining.Ability.Lower"), LocaleLoader.getString("Mining.Ability.Ready")),
-    SHOVEL(LocaleLoader.getString("Excavation.Ability.Lower"), LocaleLoader.getString("Excavation.Ability.Ready")),
-    SWORD(LocaleLoader.getString("Swords.Ability.Lower"), LocaleLoader.getString("Swords.Ability.Ready"));
+    AXE("Axes.Ability.Lower", "Axes.Ability.Ready"),
+    FISTS("Unarmed.Ability.Lower", "Unarmed.Ability.Ready"),
+    HOE("Herbalism.Ability.Lower", "Herbalism.Ability.Ready"),
+    PICKAXE("Mining.Ability.Lower", "Mining.Ability.Ready"),
+    SHOVEL("Excavation.Ability.Lower", "Excavation.Ability.Ready"),
+    SWORD("Swords.Ability.Lower", "Swords.Ability.Ready");
 
     private String lowerTool;
     private String raiseTool;

+ 24 - 19
src/main/java/com/gmail/nossr50/events/skills/McMMOPlayerNotificationEvent.java

@@ -1,6 +1,8 @@
 package com.gmail.nossr50.events.skills;
 
 import com.gmail.nossr50.datatypes.interactions.NotificationType;
+import net.md_5.bungee.api.ChatMessageType;
+import net.md_5.bungee.api.chat.TextComponent;
 import org.bukkit.entity.Player;
 import org.bukkit.event.Cancellable;
 import org.bukkit.event.HandlerList;
@@ -12,13 +14,16 @@ import org.bukkit.event.player.PlayerEvent;
 public class McMMOPlayerNotificationEvent extends PlayerEvent implements Cancellable {
     private boolean isCancelled;
     private static final HandlerList handlers = new HandlerList();
-    protected String notificationMessage;
+    protected ChatMessageType chatMessageType;
+
+    protected TextComponent notificationTextComponent;
     protected final NotificationType notificationType;
 
-    public McMMOPlayerNotificationEvent(Player who, NotificationType notificationType, String notificationMessage) {
+    public McMMOPlayerNotificationEvent(Player who, NotificationType notificationType, net.md_5.bungee.api.chat.TextComponent notificationTextComponent, ChatMessageType chatMessageType) {
         super(who);
         this.notificationType = notificationType;
-        this.notificationMessage = notificationMessage;
+        this.notificationTextComponent = notificationTextComponent;
+        this.chatMessageType = chatMessageType;
         isCancelled = false;
     }
 
@@ -26,28 +31,28 @@ public class McMMOPlayerNotificationEvent extends PlayerEvent implements Cancell
      * Getters & Setters
      */
 
-    /**
-     * The notification type for this event
-     * @return this event's notification type
-     */
-    public NotificationType getEventNotificationType() {
-        return notificationType;
+    public TextComponent getNotificationTextComponent() {
+        return notificationTextComponent;
     }
 
-    /**
-     * The message delivered to players by this notification
-     * @return the message that will be delivered to the player
-     */
-    public String getNotificationMessage() {
-        return notificationMessage;
+    public void setNotificationTextComponent(TextComponent notificationTextComponent) {
+        this.notificationTextComponent = notificationTextComponent;
+    }
+
+    public ChatMessageType getChatMessageType() {
+        return chatMessageType;
+    }
+
+    public void setChatMessageType(ChatMessageType chatMessageType) {
+        this.chatMessageType = chatMessageType;
     }
 
     /**
-     * Change the notification message
-     * @param newMessage the new replacement message
+     * The notification type for this event
+     * @return this event's notification type
      */
-    public void setNotificationMessage(String newMessage) {
-        notificationMessage = newMessage;
+    public NotificationType getEventNotificationType() {
+        return notificationType;
     }
 
     /*

+ 53 - 13
src/main/java/com/gmail/nossr50/listeners/InteractionManager.java

@@ -2,6 +2,8 @@ package com.gmail.nossr50.listeners;
 
 import com.gmail.nossr50.config.AdvancedConfig;
 import com.gmail.nossr50.datatypes.interactions.NotificationType;
+import com.gmail.nossr50.datatypes.player.McMMOPlayer;
+import com.gmail.nossr50.datatypes.skills.PrimarySkill;
 import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
 import com.gmail.nossr50.datatypes.skills.subskills.interfaces.InteractType;
 import com.gmail.nossr50.datatypes.skills.subskills.interfaces.Interaction;
@@ -10,10 +12,12 @@ import com.gmail.nossr50.locale.LocaleLoader;
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.util.TextComponentFactory;
 import net.md_5.bungee.api.ChatMessageType;
+import net.md_5.bungee.api.chat.TextComponent;
 import org.bukkit.Bukkit;
 import org.bukkit.entity.Player;
 import org.bukkit.event.Event;
 
+import java.awt.*;
 import java.util.ArrayList;
 import java.util.HashMap;
 
@@ -91,25 +95,61 @@ public class InteractionManager {
      * This does this by sending out an event so other plugins can cancel it
      * @param player target player
      * @param notificationType notifications defined type
-     * @param localeKey the locale key for the notifications defined message
+     * @param key the locale key for the notifications defined message
      */
-    public static void sendPlayerInformation(Player player, NotificationType notificationType, String localeKey)
+    public static void sendPlayerInformation(Player player, NotificationType notificationType, String key)
     {
+
+        ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
+
+        TextComponent message = TextComponentFactory.getNotificationTextComponentFromLocale(key, notificationType);
+        McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(player, notificationType, destination, message);
+
+        sendNotification(player, customEvent);
+    }
+
+    public static void sendPlayerInformation(Player player, NotificationType notificationType, String key, String... values)
+    {
+
+        ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
+
+        TextComponent message = TextComponentFactory.getNotificationTextComponentFromLocale(key, notificationType, values);
+        McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(player, notificationType, destination, message);
+
+        sendNotification(player, customEvent);
+    }
+
+    private static void sendNotification(Player player, McMMOPlayerNotificationEvent customEvent) {
+        if (customEvent.isCancelled())
+            return;
+
+        player.spigot().sendMessage(customEvent.getChatMessageType(), customEvent.getNotificationTextComponent());
+    }
+
+    private static McMMOPlayerNotificationEvent checkNotificationEvent(Player player, NotificationType notificationType, ChatMessageType destination, TextComponent message) {
         //Init event
-        McMMOPlayerNotificationEvent customEvent = new McMMOPlayerNotificationEvent(player, notificationType, LocaleLoader.getString(localeKey));
+        McMMOPlayerNotificationEvent customEvent = new McMMOPlayerNotificationEvent(player,
+                notificationType, message, destination);
+
         //Call event
         Bukkit.getServer().getPluginManager().callEvent(customEvent);
+        return customEvent;
+    }
 
-        //Check to see if our custom event is cancelled
-        if(!customEvent.isCancelled())
-        {
-            if(AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType))
-            {
-                player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponentFactory.getNotificationTextComponent(customEvent.getNotificationMessage(), notificationType));
-            } else {
-                player.spigot().sendMessage(ChatMessageType.SYSTEM, TextComponentFactory.getNotificationTextComponent(customEvent.getNotificationMessage(), notificationType));
-            }
-        }
+    /**
+     * Handles sending level up notifications to a mcMMOPlayer
+     * @param mcMMOPlayer target mcMMOPlayer
+     * @param skillName skill that leveled up
+     * @param newLevel new level of that skill
+     */
+    public static void sendPlayerLevelUpNotification(McMMOPlayer mcMMOPlayer, PrimarySkill skillName, int newLevel)
+    {
+        ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(NotificationType.LEVEL_UP_MESSAGE) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
+
+        TextComponent levelUpTextComponent = TextComponentFactory.getNotificationLevelUpTextComponent(mcMMOPlayer, skillName, newLevel);
+        McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(mcMMOPlayer.getPlayer(), NotificationType.LEVEL_UP_MESSAGE, destination, levelUpTextComponent);
+
+        sendNotification(mcMMOPlayer.getPlayer(), customEvent);
     }
 
     /**

+ 3 - 1
src/main/java/com/gmail/nossr50/runnables/skills/ToolLowerTask.java

@@ -1,5 +1,7 @@
 package com.gmail.nossr50.runnables.skills;
 
+import com.gmail.nossr50.datatypes.interactions.NotificationType;
+import com.gmail.nossr50.listeners.InteractionManager;
 import org.bukkit.scheduler.BukkitRunnable;
 
 import com.gmail.nossr50.config.Config;
@@ -24,7 +26,7 @@ public class ToolLowerTask extends BukkitRunnable {
         mcMMOPlayer.setToolPreparationMode(tool, false);
 
         if (Config.getInstance().getAbilityMessagesEnabled()) {
-            mcMMOPlayer.getPlayer().sendMessage(tool.getLowerTool());
+            InteractionManager.sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.TOOL, tool.getLowerTool());
         }
     }
 }

+ 59 - 2
src/main/java/com/gmail/nossr50/util/TextComponentFactory.java

@@ -5,6 +5,7 @@ import com.gmail.nossr50.config.AdvancedConfig;
 import com.gmail.nossr50.config.Config;
 import com.gmail.nossr50.datatypes.interactions.NotificationType;
 import com.gmail.nossr50.datatypes.json.McMMOUrl;
+import com.gmail.nossr50.datatypes.player.McMMOPlayer;
 import com.gmail.nossr50.datatypes.skills.PrimarySkill;
 import com.gmail.nossr50.datatypes.skills.SubSkillType;
 import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
@@ -26,12 +27,68 @@ public class TextComponentFactory {
 
     public static BaseComponent[] webComponents;
 
-    public static TextComponent getNotificationTextComponent(String localeKey, NotificationType notificationType)
+    /**
+     * This one is a bit simple
+     * @param localeKey
+     * @param notificationType
+     * @param values
+     * @return
+     */
+    public static TextComponent getNotificationTextComponentFromLocale(String localeKey, NotificationType notificationType, String... values)
+    {
+        //TODO: Make this colored
+        return new TextComponent(LocaleLoader.getString(localeKey, values));
+    }
+
+    public static TextComponent getNotificationTextComponentFromLocale(String localeKey, NotificationType notificationType)
+    {
+        return getNotificationTextComponent(LocaleLoader.getString(localeKey), notificationType);
+    }
+
+    public static TextComponent getNotificationLevelUpTextComponent(McMMOPlayer player, PrimarySkill skill, int currentLevel)
+    {
+        //player.sendMessage(LocaleLoader.getString(StringUtils.getCapitalized(primarySkill.toString()) + ".Skillup", levelsGained, getSkillLevel(primarySkill)));
+        TextComponent textComponent = new TextComponent(LocaleLoader.getString("JSON."+StringUtils.getCapitalized(skill.toString()))
+                +" "+LocaleLoader.getString("JSON.LevelUp"));
+        textComponent.setColor(AdvancedConfig.getInstance().getJSONActionBarColor(NotificationType.LEVEL_UP_MESSAGE));
+        TextComponent childComponent = new TextComponent(" "+currentLevel);
+        //TODO: Config
+        childComponent.setColor(ChatColor.GREEN);
+        childComponent.setBold(true);
+        textComponent.addExtra(childComponent);
+        return textComponent;
+    }
+
+    public static TextComponent getNotificationTextComponent(String text, NotificationType notificationType)
     {
-        TextComponent textComponent = new TextComponent(LocaleLoader.getString(localeKey));
+        System.out.println("Test");
+        TextComponent textComponent = new TextComponent(text);
+        textComponent.setColor(getNotificationColor(notificationType));
         return textComponent;
     }
 
+    public static ChatColor getNotificationColor(NotificationType notificationType)
+    {
+        ChatColor color = ChatColor.WHITE;
+        switch(notificationType)
+        {
+            case SUPER_ABILITY:
+                break;
+            case TOOL:
+                break;
+            case SUBSKILL_UNLOCKED:
+                break;
+            case SUBSKILL_MESSAGE:
+                break;
+            case LEVEL_UP_MESSAGE:
+                break;
+            case XP_GAIN:
+                break;
+        }
+
+        return color;
+    }
+
     public static void sendPlayerUrlHeader(Player player) {
         if(!Config.getInstance().getUrlLinksEnabled())
             return;

+ 6 - 0
src/main/java/com/gmail/nossr50/util/scoreboards/ObjectiveType.java

@@ -0,0 +1,6 @@
+package com.gmail.nossr50.util.scoreboards;
+
+public enum ObjectiveType {
+    SIDEBAR,
+    POWER
+}

+ 3 - 2
src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java

@@ -32,8 +32,9 @@ import com.google.common.collect.Lists;
 public class ScoreboardManager {
     static final Map<String, ScoreboardWrapper> PLAYER_SCOREBOARDS = new HashMap<String, ScoreboardWrapper>();
 
+
     // do not localize; these are internal identifiers
-    static final String SIDEBAR_OBJECTIVE = "mcmmo_sidebar";
+    //static final String SIDEBAR_OBJECTIVE = "mcmmo_sidebar";
     static final String POWER_OBJECTIVE = "mcmmo_pwrlvl";
 
     static final String HEADER_STATS = LocaleLoader.getString("Scoreboard.Header.PlayerStats");
@@ -401,7 +402,7 @@ public class ScoreboardManager {
         Objective powerObjective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().getObjective(POWER_OBJECTIVE);
 
         if (powerObjective == null) {
-            powerObjective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().registerNewObjective(POWER_OBJECTIVE, "dummy");
+        powerObjective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().registerNewObjective(POWER_OBJECTIVE, "dummy");
             powerObjective.setDisplayName(TAG_POWER_LEVEL);
             powerObjective.setDisplaySlot(DisplaySlot.BELOW_NAME);
         }

+ 34 - 6
src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java

@@ -2,6 +2,7 @@ package com.gmail.nossr50.util.scoreboards;
 
 import java.util.List;
 import java.util.Map;
+import java.util.UUID;
 
 import org.bukkit.ChatColor;
 import org.bukkit.entity.Player;
@@ -30,6 +31,7 @@ import org.apache.commons.lang.Validate;
 public class ScoreboardWrapper {
     // Initialization variables
     public final String playerName;
+    public final UUID playerUUID;
     private final Scoreboard scoreboard;
     private boolean tippedKeep = false;
     private boolean tippedClear = false;
@@ -46,12 +48,24 @@ public class ScoreboardWrapper {
     private PlayerProfile targetProfile = null;
     public int leaderboardPage = -1;
 
-    private ScoreboardWrapper(String playerName, Scoreboard scoreboard) {
-        this.playerName = playerName;
+    private ScoreboardWrapper(Player player, Scoreboard scoreboard) {
+        this.playerName = player.getName();
         this.scoreboard = scoreboard;
+        this.playerUUID = player.getUniqueId();
         sidebarType = SidebarType.NONE;
-        sidebarObjective = this.scoreboard.registerNewObjective(ScoreboardManager.SIDEBAR_OBJECTIVE, "dummy");
-        powerObjective = this.scoreboard.registerNewObjective(ScoreboardManager.POWER_OBJECTIVE, "dummy");
+
+        if(this.scoreboard.getObjective(getObjective(ObjectiveType.SIDEBAR)) == null)
+            sidebarObjective = this.scoreboard.registerNewObjective(getObjective(ObjectiveType.SIDEBAR), "dummy");
+        else
+        {
+            this.scoreboard.getObjective(getObjective(ObjectiveType.SIDEBAR)).unregister();
+            sidebarObjective = this.scoreboard.registerNewObjective(getObjective(ObjectiveType.SIDEBAR), "dummy");
+        }
+
+        if(this.scoreboard.getObjective(getObjective(ObjectiveType.POWER)) == null)
+            powerObjective = this.scoreboard.registerNewObjective(getObjective(ObjectiveType.POWER), "dummy");
+        else
+            powerObjective = this.scoreboard.getObjective(getObjective(ObjectiveType.POWER));
 
         if (Config.getInstance().getPowerLevelTagsEnabled()) {
             powerObjective.setDisplayName(ScoreboardManager.TAG_POWER_LEVEL);
@@ -63,8 +77,22 @@ public class ScoreboardWrapper {
         }
     }
 
+    public String getObjective(ObjectiveType objectiveType)
+    {
+        switch(objectiveType)
+        {
+            case POWER:
+                return ScoreboardManager.POWER_OBJECTIVE;
+            case SIDEBAR:
+                return playerName;
+            default:
+                return playerName;
+
+        }
+    }
+
     public static ScoreboardWrapper create(Player player) {
-        return new ScoreboardWrapper(player.getName(), mcMMO.p.getServer().getScoreboardManager().getMainScoreboard());
+        return new ScoreboardWrapper(player, mcMMO.p.getServer().getScoreboardManager().getMainScoreboard());
     }
 
     public BukkitTask updateTask = null;
@@ -372,7 +400,7 @@ public class ScoreboardWrapper {
     // Setup for after a board type change
     protected void loadObjective(String displayName) {
         sidebarObjective.unregister();
-        sidebarObjective = scoreboard.registerNewObjective(ScoreboardManager.SIDEBAR_OBJECTIVE, "dummy");
+        sidebarObjective = scoreboard.registerNewObjective(getObjective(ObjectiveType.SIDEBAR), "dummy");
 
         if (displayName.length() > 32) {
             displayName = displayName.substring(0, 32);

+ 16 - 24
src/main/resources/advanced.yml

@@ -671,30 +671,22 @@ Skills:
 Style:
     JSON:
         Notification:
-                LevelUps:
-                    Bold: true
-                    Italics: false
-                    Underline: false
-                ToolReady:
-                    Bold: false
-                    Italics: true
-                    Underline: false
-                SubSkillInteraction:
-                    Bold: false
-                    Italics: true
-                    Underline: false
-                SubSkillUnlocked:
-                    Bold: true
-                    Italics: false
-                    Underline: false
-                SuperAbilityInteraction:
-                    Bold: true
-                    Italics: false
-                    Underline: false
-                ExperienceGain:
-                    Bold: true
-                    Italics: false
-                    Underline: false
+            LevelRequirementNotMet:
+                Color: RED
+            AbilityCoolDown:
+                Color: RED
+            LevelUps:
+                Color: GOLD
+            ToolReady:
+                Color: GREEN
+            SubSkillInteraction:
+                Color: YELLOW
+            SubSkillUnlocked:
+                Color: PURPLE
+            SuperAbilityInteraction:
+                Color: DARK_AQUA
+            ExperienceGain:
+                Color: WHITE
         Hover:
             Details:
                 Header:

+ 15 - 0
src/main/resources/locale/locale_en_US.properties

@@ -25,6 +25,21 @@ JSON.JWrapper.Target.Mobs=Mobs
 JSON.JWrapper.Perks.Header=[[GOLD]]Lucky Perks
 JSON.JWrapper.Perks.Lucky={0}% Better Odds
 JSON.Hover.Tips=Tips
+JSON.Acrobatics=Acrobatics
+JSON.Alchemy=Alchemy
+JSON.Archery=Archery
+JSON.Axes=Axes
+JSON.Excavation=Excavation
+JSON.Fishing=Fishing
+JSON.Herbalism=Herbalism
+JSON.Mining=Mining
+JSON.Repair=Repair
+JSON.Salvage=Salvage
+JSON.Swords=Swords
+JSON.Taming=Taming
+JSON.Unarmed=Unarmed
+JSON.Woodcutting=Woodcutting
+JSON.LevelUp=increased to
 
 #This is the message sent to players when an ability is activated
 JSON.Notification.SuperAbility={0}