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

import java.util.*;

public class QuestProgress {

    private Map<String, TaskProgress> taskProgress = new HashMap<>();
    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.put(taskProgress.getTaskId(), taskProgress);
    }

    public Collection<TaskProgress> getTaskProgress() {
        return taskProgress.values();
    }

    public TaskProgress getTaskProgress(String taskId) {
        return taskProgress.getOrDefault(taskId, null);
    }

    public boolean isWorthSaving() {
        return modified;
    }

    public void setWorthSaving(boolean modified) {
        this.modified = modified;
    }
}