mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 02:25:42 +01:00
Reset target of Quest Compass on quit
This commit is contained in:
parent
969bac022d
commit
3413895abf
@ -174,8 +174,7 @@ public class QuestRequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||
return ChatColor.GRAY + "(" + BukkitLang.get("noneSet") + ")";
|
||||
} else {
|
||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + moneyReq + " "
|
||||
+ (moneyReq > 1 ? plugin.getDependencies().getVaultEconomy().currencyNamePlural()
|
||||
: plugin.getDependencies().getVaultEconomy().currencyNameSingular() + ChatColor.GRAY + ")");
|
||||
+ plugin.getDependencies().getVaultEconomy().format(moneyReq) + ChatColor.GRAY + ")";
|
||||
}
|
||||
} else {
|
||||
return ChatColor.GRAY + "(" + BukkitLang.get("notInstalled") + ")";
|
||||
|
@ -424,6 +424,7 @@ public class BukkitQuester implements Quester {
|
||||
|
||||
/**
|
||||
* Get quest progress for given quest, or default values if not found
|
||||
*
|
||||
* @param quest The quest to check
|
||||
* @return Existing or current progress, or default
|
||||
*/
|
||||
@ -432,12 +433,6 @@ public class BukkitQuester implements Quester {
|
||||
if (questProgress.get(quest) != null) {
|
||||
return questProgress.get(quest);
|
||||
}
|
||||
// TODO - the above should suffice since Quest extends Comparable, but test it
|
||||
/*for (final Quest q : questData.keySet()) {
|
||||
if (q.getId().equals(quest.getId())) {
|
||||
return questData.get(q);
|
||||
}
|
||||
}*/
|
||||
if (currentQuests.get(quest) != null) {
|
||||
addEmptiesFor(quest, currentQuests.get(quest));
|
||||
}
|
||||
@ -4350,6 +4345,9 @@ public class BukkitQuester implements Quester {
|
||||
*/
|
||||
public void hardQuit(final Quest quest) {
|
||||
try {
|
||||
if (compassTargetQuestId.equals(quest.getId())) {
|
||||
compassTargetQuestId = null;
|
||||
}
|
||||
currentQuests.remove(quest);
|
||||
questProgress.remove(quest);
|
||||
if (!timers.isEmpty()) {
|
||||
@ -4441,11 +4439,11 @@ public class BukkitQuester implements Quester {
|
||||
* Will set to Quester's spawn location if bed spawn does not exist
|
||||
*/
|
||||
public void resetCompass() {
|
||||
compassTargetQuestId = null;
|
||||
final Player player = getPlayer();
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
compassTargetQuestId = null;
|
||||
if (!canUseCompass()) {
|
||||
return;
|
||||
}
|
||||
@ -4485,7 +4483,8 @@ public class BukkitQuester implements Quester {
|
||||
* @param notify Whether to notify this quester of result
|
||||
*/
|
||||
public void findNextCompassTarget(final boolean notify) {
|
||||
if (!canUseCompass()) {
|
||||
// Here we apply this method to OPs by not checking #canUseCompass
|
||||
if (getPlayer() == null || !getPlayer().hasPermission("quests.compass")) {
|
||||
return;
|
||||
}
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
|
@ -43,7 +43,6 @@ import me.pikamug.quests.quests.components.Planner;
|
||||
import me.pikamug.quests.quests.components.Requirements;
|
||||
import me.pikamug.quests.quests.components.Rewards;
|
||||
import me.pikamug.quests.quests.components.Stage;
|
||||
import me.pikamug.quests.tasks.BukkitStageTimer;
|
||||
import me.pikamug.quests.util.BukkitConfigUtil;
|
||||
import me.pikamug.quests.util.BukkitInventoryUtil;
|
||||
import me.pikamug.quests.util.BukkitItemUtil;
|
||||
@ -280,10 +279,6 @@ public class BukkitQuest implements Quest {
|
||||
this, quester.getPlayer()));
|
||||
}
|
||||
}
|
||||
if (quester.getPlayer().hasPermission("quests.compass")) {
|
||||
quester.resetCompass();
|
||||
quester.findCompassTarget();
|
||||
}
|
||||
if (currentStage.getDelay() < 0) {
|
||||
doNextStage(quester, allowSharedProgress);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user