This commit is contained in:
PikaMug 2019-09-11 00:58:36 -04:00
parent 5ef3e4a2b1
commit 8f147aed46

View File

@ -154,73 +154,71 @@ public class Quest {
public void setInitialAction(Action initialAction) {
this.initialAction = initialAction;
}
/**
* Force player to proceed to the next ordered stage
*
* @param quester Player to force
* @deprecated Use nextStage(Quester, boolean)
*/
public void nextStage(Quester quester) {
nextStage(quester, false);
}
/**
* Force player to proceed to the next ordered stage
*
* @param q Player to force
* @param quester Player to force
* @param allowSharedProgress Whether to distribute progress to fellow questers
*/
public void nextStage(Quester q, boolean enableShareProgress) {
Stage currentStage = q.getCurrentStage(this);
public void nextStage(Quester quester, boolean allowSharedProgress) {
Stage currentStage = quester.getCurrentStage(this);
if (currentStage == null) {
plugin.getLogger().severe("Current stage was null for quester " + q.getPlayer().getUniqueId());
plugin.getLogger().severe("Current stage was null for quester " + quester.getPlayer().getUniqueId());
return;
}
String stageCompleteMessage = currentStage.completeMessage;
if (stageCompleteMessage != null) {
q.getPlayer().sendMessage(plugin.parseStringWithPossibleLineBreaks(stageCompleteMessage, this, q.getPlayer()));
quester.getPlayer().sendMessage(plugin.parseStringWithPossibleLineBreaks(stageCompleteMessage, this, quester.getPlayer()));
}
if (plugin.getSettings().canUseCompass()) {
q.resetCompass();
q.findCompassTarget();
quester.resetCompass();
quester.findCompassTarget();
}
if (currentStage.delay < 0) {
if (q.currentQuests.get(this) == (orderedStages.size() - 1)) {
if (currentStage.finishEvent != null) {
currentStage.finishEvent.fire(quester, this);
}
if (quester.currentQuests.get(this) == (orderedStages.size() - 1)) {
if (currentStage.script != null) {
plugin.getDenizenTrigger().runDenizenScript(currentStage.script, q);
}
if (currentStage.finishEvent != null) {
currentStage.finishEvent.fire(q, this);
}
completeQuest(q);
// Multiplayer
if (enableShareProgress && opts.getShareProgressLevel() == 3) {
List<Quester> mq = q.getMultiplayerQuestersByQuest(this);
for (Quester qq : mq) {
if (currentStage.equals(qq.getCurrentStage(this))) {
completeQuest(qq);
}
}
plugin.getDenizenTrigger().runDenizenScript(currentStage.script, quester);
}
completeQuest(quester);
} else {
try {
if (currentStage.finishEvent != null) {
currentStage.finishEvent.fire(q, this);
}
setStage(q, q.currentQuests.get(this) + 1);
setStage(quester, quester.currentQuests.get(this) + 1);
} catch (InvalidStageException e) {
e.printStackTrace();
}
// Multiplayer
if (enableShareProgress && opts.getShareProgressLevel() == 3) {
List<Quester> mq = q.getMultiplayerQuestersByQuest(this);
for (Quester qq : mq) {
if (currentStage.equals(qq.getCurrentStage(this))) {
nextStage(qq, false);
}
}
if (quester.getQuestData(this) != null) {
quester.getQuestData(this).delayStartTime = 0;
quester.getQuestData(this).delayTimeLeft = -1;
}
// Multiplayer
if (opts.getShareProgressLevel() == 3) {
List<Quester> mq = quester.getMultiplayerQuestersByQuest(this);
for (Quester qq : mq) {
if (currentStage.equals(qq.getCurrentStage(this))) {
nextStage(qq, allowSharedProgress);
}
}
}
if (q.getQuestData(this) != null) {
q.getQuestData(this).delayStartTime = 0;
q.getQuestData(this).delayTimeLeft = -1;
}
} else {
q.startStageTimer(this);
quester.startStageTimer(this);
}
q.updateJournal();
quester.updateJournal();
}
/**