summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/leonardobishop/quests/QuestsConfigLoader.java3
-rw-r--r--src/main/java/com/leonardobishop/quests/player/questprogressfile/QuestProgressFile.java7
-rw-r--r--src/main/java/com/leonardobishop/quests/quests/tasktypes/TaskType.java20
3 files changed, 25 insertions, 5 deletions
diff --git a/src/main/java/com/leonardobishop/quests/QuestsConfigLoader.java b/src/main/java/com/leonardobishop/quests/QuestsConfigLoader.java
index b11544d1..cd9c1345 100644
--- a/src/main/java/com/leonardobishop/quests/QuestsConfigLoader.java
+++ b/src/main/java/com/leonardobishop/quests/QuestsConfigLoader.java
@@ -258,7 +258,8 @@ public class QuestsConfigLoader {
for (TaskType taskType : plugin.getTaskTypeManager().getTaskTypes()) {
try {
taskType.onReady();
- } catch (Exception ignored) {
+ } catch (Exception e) {
+ e.printStackTrace();
}
}
}
diff --git a/src/main/java/com/leonardobishop/quests/player/questprogressfile/QuestProgressFile.java b/src/main/java/com/leonardobishop/quests/player/questprogressfile/QuestProgressFile.java
index 7a7fde21..6d9b2972 100644
--- a/src/main/java/com/leonardobishop/quests/player/questprogressfile/QuestProgressFile.java
+++ b/src/main/java/com/leonardobishop/quests/player/questprogressfile/QuestProgressFile.java
@@ -194,6 +194,13 @@ public class QuestProgressFile {
player.sendMessage(ChatColor.translateAlternateColorCodes('&', s));
}
}
+ for (Task task : quest.getTasks()) {
+ try {
+ plugin.getTaskTypeManager().getTaskType(task.getType()).onStart(quest, task, playerUUID);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
}
return code;
}
diff --git a/src/main/java/com/leonardobishop/quests/quests/tasktypes/TaskType.java b/src/main/java/com/leonardobishop/quests/quests/tasktypes/TaskType.java
index 1b4e00b6..a085a89c 100644
--- a/src/main/java/com/leonardobishop/quests/quests/tasktypes/TaskType.java
+++ b/src/main/java/com/leonardobishop/quests/quests/tasktypes/TaskType.java
@@ -2,12 +2,10 @@ package com.leonardobishop.quests.quests.tasktypes;
import com.leonardobishop.quests.QuestsConfigLoader;
import com.leonardobishop.quests.quests.Quest;
+import com.leonardobishop.quests.quests.Task;
import org.bukkit.event.Listener;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
+import java.util.*;
/**
* A task type which can be used within Quests. A {@link Quest}
@@ -83,14 +81,28 @@ public abstract class TaskType implements Listener {
return Collections.emptyList();
}
+ /**
+ * Called when Quests has finished registering all quests to the task type
+ * May be called several times if an operator uses /quests admin reload
+ */
public void onReady() {
// not implemented here
}
+ /**
+ * Called when a player starts a quest containing a task of this type
+ */
+ public void onStart(Quest quest, Task task, UUID playerUUID) {
+ // not implemented here
+ }
+
public void onDisable() {
// not implemented here
}
+ /**
+ * Called when Quests reloads the configuration - used to detect errors in the configuration of your task type
+ */
public List<QuestsConfigLoader.ConfigProblem> detectProblemsInConfig(String root, HashMap<String, Object> config) {
// not implemented here
return Collections.emptyList();