aboutsummaryrefslogtreecommitdiffstats
path: root/src/me/fatpigsarefat/quests/player/questprogressfile/QuestProgress.java
blob: c4fe87b278215c674abf24fd0efa8d2e83b8ec3a (plain)
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.player.questprogressfile;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

public class QuestProgress {

    private List<TaskProgress> taskProgress = new ArrayList<>();
    private String questid;
    private boolean started;
    private boolean completed;
    private boolean completedBefore;
    private long completionDate;
    private UUID player;
    private boolean modified;

    public QuestProgress(String questid, boolean completed, boolean completedBefore, long completionDate, UUID player, boolean started) {
        this.questid = questid;
        this.completed = completed;
        this.completedBefore = completedBefore;
        this.completionDate = completionDate;
        this.player = player;
        this.started = started;
    }

    public QuestProgress(String questid, boolean completed, boolean completedBefore, long completionDate, UUID player, boolean started, boolean modified) {
        this(questid, completed, completedBefore, completionDate, player, started);
        this.modified = modified;
    }

    public String getQuestId() {
        return questid;
    }

    public boolean isCompleted() {
        return completed;
    }

    public void setStarted(boolean started) {
        this.started = started;
        this.modified = true;
    }

    public boolean isStarted() {
        return started;
    }

    public void setCompleted(boolean completed) {
        this.completed = completed;
        this.modified = true;
    }

    public long getCompletionDate() {
        return completionDate;
    }

    public void setCompletionDate(long completionDate) {
        this.completionDate = completionDate;
        this.modified = true;
    }

    public UUID getPlayer() {
        return player;
    }

    public boolean isCompletedBefore() {
        return completedBefore;
    }

    public void setCompletedBefore(boolean completedBefore) {
        this.completedBefore = completedBefore;
        this.modified = true;
    }

    public void addTaskProgress(TaskProgress taskProgress) {
        this.taskProgress.add(taskProgress);
    }

    public List<TaskProgress> getTaskProgress() {
        return taskProgress;
    }

    public TaskProgress getTaskProgress(String taskId) {
        for (TaskProgress taskProgress : this.taskProgress) {
            if (taskProgress.getTaskId().equals(taskId)) {
                return taskProgress;
            }
        }
        return null;
    }

    public boolean isWorthSaving() {
        return modified;
    }
}