From d89f8086a496ed0923e41e86f11ab60b51e7f787 Mon Sep 17 00:00:00 2001 From: LMBishop <13875753+LMBishop@users.noreply.github.com> Date: Fri, 29 Apr 2022 18:10:50 +0100 Subject: Add cancellable and counts towards limit options (closes #383) --- .../leonardobishop/quests/common/quest/Quest.java | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'common') diff --git a/common/src/main/java/com/leonardobishop/quests/common/quest/Quest.java b/common/src/main/java/com/leonardobishop/quests/common/quest/Quest.java index 085ac0e9..999507b2 100644 --- a/common/src/main/java/com/leonardobishop/quests/common/quest/Quest.java +++ b/common/src/main/java/com/leonardobishop/quests/common/quest/Quest.java @@ -21,6 +21,8 @@ public class Quest implements Comparable { private int sortOrder; private boolean permissionRequired; private boolean autoStartEnabled; + private boolean cancellable; + private boolean countsTowardsLimit; private Map placeholders; private String categoryid; @@ -217,6 +219,24 @@ public class Quest implements Comparable { return autoStartEnabled; } + /** + * Get if this quest should be cancellable. + * + * @return boolean + */ + public boolean isCancellable() { + return cancellable; + } + + /** + * Get whether this quest should count towards the player's total quest limit. + * + * @return boolean + */ + public boolean doesCountTowardsLimit() { + return countsTowardsLimit; + } + /** * Compare the sort orders for this quest with another quest. * @@ -243,6 +263,8 @@ public class Quest implements Comparable { private int sortOrder = 1; private boolean permissionRequired = false; private boolean autoStartEnabled = false; + private boolean cancellable = true; + private boolean countsTowardsLimit = true; private Map placeholders = Collections.emptyMap(); private String categoryid = null; @@ -310,6 +332,16 @@ public class Quest implements Comparable { return this; } + public Builder withCancellable(boolean cancellable) { + this.cancellable = cancellable; + return this; + } + + public Builder withCountsTowardsLimit(boolean countsTowardsLimit) { + this.countsTowardsLimit = countsTowardsLimit; + return this; + } + public Builder inCategory(String categoryid) { this.categoryid = categoryid; return this; @@ -329,6 +361,8 @@ public class Quest implements Comparable { quest.sortOrder = this.sortOrder; quest.permissionRequired = this.permissionRequired; quest.autoStartEnabled = this.autoStartEnabled; + quest.countsTowardsLimit = countsTowardsLimit; + quest.cancellable = this.cancellable; quest.placeholders = this.placeholders; quest.categoryid = this.categoryid; -- cgit v1.2.3-70-g09d2