Browse Source

Fixed a NPE that could occur if Roll was disabled in coreskills.yml

nossr50 6 years ago
parent
commit
2be67bae19

+ 1 - 0
Changelog.txt

@@ -1,5 +1,6 @@
 Version 2.1.72
 Version 2.1.72
     Fixed a NPE if a server shutdown with no player data needing to be saved (the error is harmless but spammy)
     Fixed a NPE if a server shutdown with no player data needing to be saved (the error is harmless but spammy)
+    Fixed a NPE that could occur if Roll was disabled in coreskills.yml
 
 
 Version 2.1.71
 Version 2.1.71
     Salvage will now always ask for confirmation before breaking your items (instead of only asking for enchanted items)
     Salvage will now always ask for confirmation before breaking your items (instead of only asking for enchanted items)

+ 8 - 6
src/main/java/com/gmail/nossr50/listeners/InteractionManager.java

@@ -15,12 +15,7 @@ public class InteractionManager {
     private static HashMap<String, AbstractSubSkill> subSkillNameMap; //Used for mmoinfo optimization
     private static HashMap<String, AbstractSubSkill> subSkillNameMap; //Used for mmoinfo optimization
     private static ArrayList<AbstractSubSkill> subSkillList;
     private static ArrayList<AbstractSubSkill> subSkillList;
 
 
-    /**
-     * Registers subskills with the Interaction registration
-     * @param abstractSubSkill the target subskill to register
-     */
-    public static void registerSubSkill(AbstractSubSkill abstractSubSkill)
-    {
+    public static void initMaps() {
         /* INIT MAPS */
         /* INIT MAPS */
         if(interactRegister == null)
         if(interactRegister == null)
             interactRegister = new HashMap<>();
             interactRegister = new HashMap<>();
@@ -30,7 +25,14 @@ public class InteractionManager {
 
 
         if(subSkillNameMap == null)
         if(subSkillNameMap == null)
             subSkillNameMap = new HashMap<>();
             subSkillNameMap = new HashMap<>();
+    }
 
 
+    /**
+     * Registers subskills with the Interaction registration
+     * @param abstractSubSkill the target subskill to register
+     */
+    public static void registerSubSkill(AbstractSubSkill abstractSubSkill)
+    {
         //Store a unique copy of each subskill
         //Store a unique copy of each subskill
         if(!subSkillList.contains(abstractSubSkill))
         if(!subSkillList.contains(abstractSubSkill))
             subSkillList.add(abstractSubSkill);
             subSkillList.add(abstractSubSkill);

+ 2 - 0
src/main/java/com/gmail/nossr50/mcMMO.java

@@ -216,6 +216,8 @@ public class mcMMO extends JavaPlugin {
                     Permissions.generateWorldTeleportPermissions();
                     Permissions.generateWorldTeleportPermissions();
                 }
                 }
 
 
+                InteractionManager.initMaps(); //Init maps before populating ranks
+
                 //Populate Ranked Skill Maps (DO THIS LAST)
                 //Populate Ranked Skill Maps (DO THIS LAST)
                 RankUtils.populateRanks();
                 RankUtils.populateRanks();
             }
             }