2
0
Эх сурвалжийг харах

Fixed a bug involving SubSkill notifications
Fixes #3808, also fixed the notification timer

nossr50 6 жил өмнө
parent
commit
7757e187be

+ 4 - 0
Changelog.txt

@@ -7,6 +7,10 @@ Key:
   ! Change
   - Removal
 
+Version 2.1.31
+    Fixed a bug where certain SubSkills did not properly send unlock or rank up notifications
+    Fixed a bug where unlock notifications would send simultaneously for a specific skill (still happens if mmoedit changes all skill levels on a player at once)
+
 Version 2.1.30
     Fixed double drops behaving oddly
     Double_Drop config table has been renamed to Bonus_Drops, this is to jankily auto-update everyones config

+ 1 - 1
pom.xml

@@ -2,7 +2,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.gmail.nossr50.mcMMO</groupId>
     <artifactId>mcMMO</artifactId>
-    <version>2.1.30</version>
+    <version>2.1.31-SNAPSHOT</version>
     <name>mcMMO</name>
     <url>https://github.com/mcMMO-Dev/mcMMO</url>
     <scm>

+ 4 - 0
src/main/java/com/gmail/nossr50/listeners/SelfListener.java

@@ -11,6 +11,7 @@ import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.util.player.UserManager;
 import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
+import com.gmail.nossr50.util.skills.RankUtils;
 import com.gmail.nossr50.worldguard.WorldGuardManager;
 import com.gmail.nossr50.worldguard.WorldGuardUtils;
 import org.bukkit.entity.Player;
@@ -40,6 +41,9 @@ public class SelfListener implements Listener {
             UserManager.getPlayer(player).processUnlockNotifications(plugin, event.getSkill(), previousLevelGained);
         }
 
+        //Reset the delay timer
+        RankUtils.resetUnlockDelayTimer();
+
         if(Config.getInstance().getScoreboardsEnabled())
             ScoreboardManager.handleLevelUp(player, skill);
 

+ 8 - 4
src/main/java/com/gmail/nossr50/util/skills/RankUtils.java

@@ -16,6 +16,7 @@ import java.util.HashMap;
 
 public class RankUtils {
     private static HashMap<String, HashMap<Integer, Integer>> subSkillRanks;
+    private static int count = 0;
 
     /**
      *
@@ -26,8 +27,6 @@ public class RankUtils {
      */
     public static void executeSkillUnlockNotifications(Plugin plugin, McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType, int newLevel)
     {
-        int count = 0;
-
         for(SubSkillType subSkillType : primarySkillType.getSkillAbilities())
         {
             int playerRankInSkill = getRank(mcMMOPlayer.getPlayer(), subSkillType);
@@ -36,20 +35,25 @@ public class RankUtils {
 
             //If the skill doesn't have registered ranks gtfo
             if(innerMap == null || innerMap.get(playerRankInSkill) == null)
-                return;
+                continue;
 
             //The players level is the exact level requirement for this skill
             if(newLevel == innerMap.get(playerRankInSkill))
             {
                 SkillUnlockNotificationTask skillUnlockNotificationTask = new SkillUnlockNotificationTask(mcMMOPlayer, subSkillType, newLevel);
 
-                skillUnlockNotificationTask.runTaskLater(plugin, ((count * 4) + 1) * 20);
+                skillUnlockNotificationTask.runTaskLater(plugin, (count * 100));
 
                 count++;
             }
         }
     }
 
+    public static void resetUnlockDelayTimer()
+    {
+        count = 0;
+    }
+
     /* NEW SYSTEM */
     private static void addRanks(AbstractSubSkill abstractSubSkill)
     {