mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-28 05:35:33 +01:00
Tweaks to 5ef3e4a2b1
This commit is contained in:
parent
5ef3e4a2b1
commit
8f147aed46
@ -158,69 +158,67 @@ public class Quest {
|
||||
/**
|
||||
* Force player to proceed to the next ordered stage
|
||||
*
|
||||
* @param q Player to force
|
||||
* @param quester Player to force
|
||||
* @deprecated Use nextStage(Quester, boolean)
|
||||
*/
|
||||
public void nextStage(Quester q, boolean enableShareProgress) {
|
||||
Stage currentStage = q.getCurrentStage(this);
|
||||
public void nextStage(Quester quester) {
|
||||
nextStage(quester, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Force player to proceed to the next ordered stage
|
||||
*
|
||||
* @param quester Player to force
|
||||
* @param allowSharedProgress Whether to distribute progress to fellow questers
|
||||
*/
|
||||
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.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);
|
||||
}
|
||||
currentStage.finishEvent.fire(quester, this);
|
||||
}
|
||||
if (quester.currentQuests.get(this) == (orderedStages.size() - 1)) {
|
||||
if (currentStage.script != null) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
if (quester.getQuestData(this) != null) {
|
||||
quester.getQuestData(this).delayStartTime = 0;
|
||||
quester.getQuestData(this).delayTimeLeft = -1;
|
||||
}
|
||||
|
||||
// Multiplayer
|
||||
if (enableShareProgress && opts.getShareProgressLevel() == 3) {
|
||||
List<Quester> mq = q.getMultiplayerQuestersByQuest(this);
|
||||
if (opts.getShareProgressLevel() == 3) {
|
||||
List<Quester> mq = quester.getMultiplayerQuestersByQuest(this);
|
||||
for (Quester qq : mq) {
|
||||
if (currentStage.equals(qq.getCurrentStage(this))) {
|
||||
nextStage(qq, false);
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user