Browse Source

Fixing more breaks from the static abuse removal

nossr50 5 years ago
parent
commit
8ad08298d0

+ 1 - 1
src/main/java/com/gmail/nossr50/config/hocon/hardcore/ConfigHardcoreDeathPenalty.java

@@ -16,7 +16,7 @@ public class ConfigHardcoreDeathPenalty {
         HARDCORE_SKILL_TOGGLE_MAP_DEFAULT = new HashMap<>();
 
         for(PrimarySkillType primarySkillType : PrimarySkillType.values()) {
-            if(primarySkillType.isChildSkill())
+            if(primarySkillType == PrimarySkillType.SALVAGE || primarySkillType == PrimarySkillType.SMELTING)
                 continue;
 
             HARDCORE_SKILL_TOGGLE_MAP_DEFAULT.put(primarySkillType, false);

+ 2 - 1
src/main/java/com/gmail/nossr50/config/hocon/hardcore/ConfigVampirism.java

@@ -16,7 +16,8 @@ public class ConfigVampirism {
         HARDCORE_SKILL_TOGGLE_MAP_DEFAULT = new HashMap<>();
 
         for(PrimarySkillType primarySkillType : PrimarySkillType.values()) {
-            if(primarySkillType.isChildSkill())
+            //TODO: Hacky fix to avoid the main class reference
+            if(primarySkillType == PrimarySkillType.SALVAGE || primarySkillType == PrimarySkillType.SMELTING)
                 continue;
 
             HARDCORE_SKILL_TOGGLE_MAP_DEFAULT.put(primarySkillType, false);

+ 2 - 2
src/main/java/com/gmail/nossr50/events/skills/secondaryabilities/SubSkillEvent.java

@@ -19,8 +19,8 @@ public class SubSkillEvent extends McMMOPlayerSkillEvent implements Cancellable
      * @Deprecated Skills will be using a new system stemming from the AbstractSubSkill class so make sure you check for both events, this event will be removed eventually.
      */
     @Deprecated
-    public SubSkillEvent(Player player, SubSkillType subSkillType) {
-        super(player, PrimarySkillType.getPrimarySkillBySubSkill(subSkillType));
+    public SubSkillEvent(Player player, SubSkillType subSkillType, PrimarySkillType primarySkillType) {
+        super(player, primarySkillType);
         this.subSkillType = subSkillType;
     }
 

+ 5 - 5
src/main/java/com/gmail/nossr50/util/EventManager.java

@@ -165,8 +165,8 @@ public class EventManager {
      * Others
      */
 
-    public McMMOPlayerAbilityActivateEvent callPlayerAbilityActivateEvent(Player player, PrimarySkillType skill) {
-        McMMOPlayerAbilityActivateEvent event = new McMMOPlayerAbilityActivateEvent(player, skill);
+    public McMMOPlayerAbilityActivateEvent callPlayerAbilityActivateEvent(Player player, PrimarySkillType primarySkillType, SuperAbilityType superAbilityType) {
+        McMMOPlayerAbilityActivateEvent event = new McMMOPlayerAbilityActivateEvent(player, primarySkillType, superAbilityType);
         pluginRef.getServer().getPluginManager().callEvent(event);
 
         return event;
@@ -180,8 +180,8 @@ public class EventManager {
      * @return the event after it has been fired
      */
     @Deprecated
-    public SubSkillEvent callSubSkillEvent(Player player, SubSkillType subSkillType) {
-        SubSkillEvent event = new SubSkillEvent(player, subSkillType);
+    public SubSkillEvent callSubSkillEvent(Player player, SubSkillType subSkillType, PrimarySkillType primarySkillType) {
+        SubSkillEvent event = new SubSkillEvent(player, subSkillType, primarySkillType);
         pluginRef.getServer().getPluginManager().callEvent(event);
 
         return event;
@@ -412,7 +412,7 @@ public class EventManager {
     }
 
     public void callAbilityDeactivateEvent(Player player, SuperAbilityType superAbilityType) {
-        McMMOPlayerAbilityDeactivateEvent event = new McMMOPlayerAbilityDeactivateEvent(player, pluginRef.getSkillTools().getPrimarySkillBySuperAbility(superAbilityType));
+        McMMOPlayerAbilityDeactivateEvent event = new McMMOPlayerAbilityDeactivateEvent(player, pluginRef.getSkillTools().getPrimarySkillBySuperAbility(superAbilityType), superAbilityType);
         pluginRef.getServer().getPluginManager().callEvent(event);
 
     }

+ 1 - 1
src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java

@@ -159,7 +159,7 @@ public final class CommandRegistrationManager {
         command.setPermission(null); //No perm required to save support headaches
         command.setPermissionMessage(permissionsMessage);
         command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mmodebug"));
-        command.setExecutor(new PlayerDebugCommand());
+        command.setExecutor(new PlayerDebugCommand(pluginRef));
     }
 
     private void registerMcChatSpyCommand() {

+ 1 - 1
src/main/java/com/gmail/nossr50/util/nbt/RawNBT.java

@@ -1,7 +1,7 @@
 package com.gmail.nossr50.util.nbt;
 
 import com.gmail.nossr50.mcMMO;
-import net.minecraft.server.v1_13_R2.NBTBase;
+import net.minecraft.server.v1_14_R1.NBTBase;
 
 /**
  * A simple class that acts as a container for raw NBT data

+ 1 - 1
src/main/java/com/gmail/nossr50/util/random/RandomChanceTools.java

@@ -43,7 +43,7 @@ public class RandomChanceTools {
             case RANDOM_STATIC_CHANCE:
                 return checkRandomStaticChanceExecutionSuccess(player, subSkillType);
             case ALWAYS_FIRES:
-                SubSkillEvent event = pluginRef.getEventManager().callSubSkillEvent(player, subSkillType);
+                SubSkillEvent event = pluginRef.getEventManager().callSubSkillEvent(player, subSkillType, pluginRef.getSkillTools().getPrimarySkillBySubSkill(subSkillType));
                 return !event.isCancelled();
             default:
                 return false;

+ 11 - 8
src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardStrings.java

@@ -57,13 +57,13 @@ public class ScoreboardStrings {
         LABEL_ABILITY_COOLDOWN = pluginRef.getLocaleManager().getString("Scoreboard.Misc.Cooldown");
         LABEL_OVERALL = pluginRef.getLocaleManager().getString("Scoreboard.Misc.Overall");
 
-        init(pluginRef);
+        init();
     }
 
     /*
      * Initializes the properties of this class
      */
-    private void init(mcMMO pluginRef) {
+    private void init() {
         /*
          * We need immutable objects for our ConfigScoreboard's labels
          */
@@ -101,10 +101,10 @@ public class ScoreboardStrings {
                 skillLabelBuilder.put(primarySkillType, getShortenedName(colors.get(i) + pluginRef.getSkillTools().getLocalizedSkillName(primarySkillType), false));
 
                 if (pluginRef.getSkillTools().getSuperAbility(primarySkillType) != null) {
-                    abilityLabelBuilder.put(pluginRef.getSkillTools().getSuperAbility(primarySkillType), getShortenedName(colors.get(i) + pluginRef.getSkillTools().getSuperAbility(primarySkillType).getPrettySuperAbilityName()));
+                    abilityLabelBuilder.put(pluginRef.getSkillTools().getSuperAbility(primarySkillType), getShortenedName(colors.get(i) + pluginRef.getSkillTools().getPrettySuperAbilityName(pluginRef.getSkillTools().getSuperAbility(primarySkillType))));
 
                     if (primarySkillType == PrimarySkillType.MINING) {
-                        abilityLabelBuilder.put(SuperAbilityType.BLAST_MINING, getShortenedName(colors.get(i) + SuperAbilityType.BLAST_MINING.getPrettySuperAbilityName()));
+                        abilityLabelBuilder.put(SuperAbilityType.BLAST_MINING, getShortenedName(colors.get(i) + pluginRef.getSkillTools().getPrettySuperAbilityName(SuperAbilityType.BLAST_MINING)));
                     }
                 }
 
@@ -123,17 +123,20 @@ public class ScoreboardStrings {
                 skillLabelBuilder.put(primarySkillType, getShortenedName(ChatColor.GREEN + pluginRef.getSkillTools().getLocalizedSkillName(primarySkillType)));
 
                 if (pluginRef.getSkillTools().getSuperAbility(primarySkillType) != null) {
-                    abilityLabelBuilder.put(pluginRef.getSkillTools().getSuperAbility(primarySkillType), formatAbility(pluginRef.getSkillTools().getSuperAbility(primarySkillType).getPrettySuperAbilityName()));
+                    abilityLabelBuilder.put(pluginRef.getSkillTools().getSuperAbility(primarySkillType),
+                            formatAbility(pluginRef.getSkillTools().getPrettySuperAbilityName(pluginRef.getSkillTools().getSuperAbility(primarySkillType))));
 
                     if (primarySkillType == PrimarySkillType.MINING) {
-                        abilityLabelBuilder.put(SuperAbilityType.BLAST_MINING, formatAbility(SuperAbilityType.BLAST_MINING.getPrettySuperAbilityName()));
+                        abilityLabelBuilder.put(SuperAbilityType.BLAST_MINING,
+                                formatAbility(pluginRef.getSkillTools().getPrettySuperAbilityName(SuperAbilityType.BLAST_MINING)));
                     }
                 }
             }
         }
 
-        for (SuperAbilityType type : SuperAbilityType.values()) {
-            abilityLabelSkillBuilder.put(type, formatAbility((type == SuperAbilityType.BLAST_MINING ? ChatColor.BLUE : ChatColor.AQUA), type.getPrettySuperAbilityName()));
+        for (SuperAbilityType superAbilityType : SuperAbilityType.values()) {
+            abilityLabelSkillBuilder.put(superAbilityType,
+                    formatAbility((superAbilityType == SuperAbilityType.BLAST_MINING ? ChatColor.BLUE : ChatColor.AQUA), pluginRef.getSkillTools().getPrettySuperAbilityName(superAbilityType)));
         }
 
         skillLabels = skillLabelBuilder.build();