1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
package me.fatpigsarefat.quests.quests;
import me.fatpigsarefat.quests.obj.misc.QItemStack;
import org.bukkit.ChatColor;
import java.util.*;
public class Quest {
private Map<String, Task> tasks = new HashMap<>();
//TODO: maybe store by <tasktypename (string), list<task>> since we never get task by id, but always get tasks by type.
private String id;
private QItemStack displayItem;
private List<String> rewards;
private List<String> requirements;
private List<String> rewardString;
private boolean repeatable;
private boolean cooldownEnabled;
private int cooldown;
private String categoryid;
public Quest(String id, QItemStack displayItem, List<String> rewards, List<String> requirements, boolean repeatable, boolean cooldownEnabled, int cooldown, List<String> rewardString, String categoryid) {
this(id, displayItem, rewards, requirements, repeatable, cooldownEnabled, cooldown, rewardString);
this.categoryid = categoryid;
}
public Quest(String id, QItemStack displayItem, List<String> rewards, List<String> requirements, boolean repeatable, boolean cooldownEnabled, int cooldown, List<String> rewardString) {
this.id = id;
this.displayItem = displayItem;
this.rewards = rewards;
this.requirements = requirements;
this.repeatable = repeatable;
this.cooldownEnabled = cooldownEnabled;
this.cooldown = cooldown;
this.rewardString = rewardString;
}
public void registerTask(Task task) {
tasks.put(task.getId(), task);
}
public Collection<Task> getTasks() {
return tasks.values();
}
public List<Task> getTasksOfType(String type) {
List<Task> tasks = new ArrayList<>();
for (Task task : getTasks()) {
if (task.getType().equals(type)) {
tasks.add(task);
}
}
return tasks;
}
public List<String> getRewardString() {
return rewardString;
}
public String getId() {
return id;
}
public QItemStack getDisplayItem() {
return displayItem;
}
public List<String> getRewards() {
return rewards;
}
public List<String> getRequirements() {
return requirements;
}
public boolean isRepeatable() {
return repeatable;
}
public boolean isCooldownEnabled() {
return cooldownEnabled;
}
public int getCooldown() {
return cooldown;
}
public String getCategoryId() {
return categoryid;
}
public String getDisplayNameStripped() {
return ChatColor.stripColor(this.displayItem.getName());
}
}
|