Fix redo-quest effect on non-redoable quests, fixes #299. Bump version

This commit is contained in:
HappyPikachu 2018-02-22 23:17:57 -05:00
parent 843697fbd9
commit a6ebca4921
3 changed files with 16 additions and 2 deletions

View File

@ -3,7 +3,7 @@
<groupId>me.blackvein.quests</groupId>
<artifactId>quests</artifactId>
<version>3.2.5</version>
<version>3.2.6</version>
<name>quests</name>
<url>https://github.com/FlyingPikachu/Quests/</url>
<packaging>jar</packaging>

View File

@ -51,7 +51,7 @@ public class NpcEffectThread implements Runnable {
NPC npc = plugin.citizens.getNPCRegistry().getNPC(e);
if (plugin.hasQuest(npc, quester)) {
showEffect(player, npc, Quests.effect);
} else if (plugin.hasCompletedQuest(npc, quester)) {
} else if (plugin.hasCompletedRedoableQuest(npc, quester)) {
showEffect(player, npc, Quests.redoEffect);
}
}

View File

@ -3966,6 +3966,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
return false;
}
// Unused internally, left for external use
public boolean hasCompletedQuest(NPC npc, Quester quester) {
for (Quest q : quests) {
if (q.npcStart != null && quester.completedQuests.contains(q.name) == true) {
@ -3978,6 +3979,19 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
}
return false;
}
public boolean hasCompletedRedoableQuest(NPC npc, Quester quester) {
for (Quest q : quests) {
if (q.npcStart != null && quester.completedQuests.contains(q.name) == true && q.redoDelay > -1) {
if (q.npcStart.getId() == npc.getId()) {
if (ignoreLockedQuests == false || ignoreLockedQuests == true && q.testRequirements(quester) == true) {
return true;
}
}
}
}
return false;
}
public static int getMCMMOSkillLevel(SkillType st, String player) {
McMMOPlayer mPlayer = UserManager.getPlayer(player);