From 7757e187bee8e47c7a667867f01daf549a3986f5 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 30 Mar 2019 16:56:00 -0700 Subject: [PATCH] Fixed a bug involving SubSkill notifications Fixes #3808, also fixed the notification timer --- Changelog.txt | 4 ++++ pom.xml | 2 +- .../com/gmail/nossr50/listeners/SelfListener.java | 4 ++++ .../com/gmail/nossr50/util/skills/RankUtils.java | 12 ++++++++---- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index a9d59d5e2..837e193ba 100644 --- a/Changelog.txt +++ b/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 diff --git a/pom.xml b/pom.xml index d7f067afe..097b88bf6 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.30 + 2.1.31-SNAPSHOT mcMMO https://github.com/mcMMO-Dev/mcMMO diff --git a/src/main/java/com/gmail/nossr50/listeners/SelfListener.java b/src/main/java/com/gmail/nossr50/listeners/SelfListener.java index 433263300..71ab9b217 100644 --- a/src/main/java/com/gmail/nossr50/listeners/SelfListener.java +++ b/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); diff --git a/src/main/java/com/gmail/nossr50/util/skills/RankUtils.java b/src/main/java/com/gmail/nossr50/util/skills/RankUtils.java index 21ba0a678..b5df535a0 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/RankUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/RankUtils.java @@ -16,6 +16,7 @@ import java.util.HashMap; public class RankUtils { private static HashMap> 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) {