*Fix reach location not saving

*Fix infinite stage loop (occurs when 2 or more stage are exactly the
same)
This commit is contained in:
Zino 2013-08-06 10:17:07 +02:00
parent 67592916fd
commit 31df651edc
3 changed files with 4898 additions and 4889 deletions

View File

@ -64,7 +64,7 @@ public class Quest {
Player player = q.getPlayer();
if(stages.indexOf(q.currentStage) == (stages.size() - 1)){
if(q.currentStageIndex >= (stages.size() - 1)){
if(q.currentStage.script != null)
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, player);
@ -81,6 +81,7 @@ public class Quest {
if(q.currentStage.event != null)
q.currentStage.event.happen(q);
q.currentStage = stages.get(stages.indexOf(q.currentStage) + 1);
q.currentStageIndex++;
q.addEmpties();
player.sendMessage(ChatColor.GOLD + "---(Objectives)---");
@ -251,6 +252,7 @@ public class Quest {
}
q.currentQuest = null;
q.currentStage = null;
q.currentStageIndex = 0;
q.saveData();
player.updateInventory();

View File

@ -1176,6 +1176,12 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
}
}
if (cc.getSessionData(pref + CK.S_REACH_LOCATIONS) != null) {
reachLocs = (LinkedList<String>) cc.getSessionData(pref + CK.S_REACH_LOCATIONS);
reachRadii = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_REACH_LOCATIONS_RADIUS);
reachNames = (LinkedList<String>) cc.getSessionData(pref + CK.S_REACH_LOCATIONS_NAMES);
}
if (cc.getSessionData(pref + CK.S_TAME_TYPES) != null) {
tames = (LinkedList<String>) cc.getSessionData(pref + CK.S_TAME_TYPES);
tameAmounts = (LinkedList<Integer>) cc.getSessionData(pref + CK.S_TAME_AMOUNTS);

View File

@ -30,6 +30,7 @@ public class Quester {
public Quest currentQuest;
public String questToTake;
Stage currentStage;
public int currentStageIndex = 0;
int questPoints = 0;
Quests plugin;
public LinkedList<String> completedQuests = new LinkedList<String>();
@ -1673,7 +1674,7 @@ public class Quester {
if (currentQuest != null) {
data.set("currentQuest", currentQuest.name);
data.set("currentStage", currentQuest.stages.indexOf(currentStage));
data.set("currentStage", currentStageIndex);
data.set("quest-points", questPoints);
if (blocksDamaged.isEmpty() == false) {