From b67ffadcac3c5c2b019c4bee53f9441fb7913c22 Mon Sep 17 00:00:00 2001 From: Krakenied Date: Sat, 1 Jun 2024 10:52:50 +0200 Subject: Add cancelstring and expirystring options Closes https://github.com/LMBishop/Quests/issues/667 --- .../leonardobishop/quests/common/quest/Quest.java | 38 ++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'common/src/main') 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 3e7fc193..a3cc26f9 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 @@ -20,6 +20,8 @@ public class Quest implements Comparable { private List requirements; private List rewardString; private List startString; + private List cancelString; + private List expiryString; private List startCommands; private List cancelCommands; private List expiryCommands; @@ -123,6 +125,26 @@ public class Quest implements Comparable { return Collections.unmodifiableList(startString); } + /** + * Get the cancel string of the quest. + * The cancel string is a series of messages sent to the player upon cancelling the quest. + * + * @return immutable list of messages to send + */ + public @NotNull List getCancelString() { + return Collections.unmodifiableList(cancelString); + } + + /** + * Get the expiry string of the quest. + * The expiry string is a series of messages sent to the player upon expiring the quest. + * + * @return immutable list of messages to send + */ + public @NotNull List getExpiryString() { + return Collections.unmodifiableList(expiryString); + } + /** * Get the id of this quest. * @@ -315,6 +337,8 @@ public class Quest implements Comparable { private List requirements = Collections.emptyList(); private List rewardString = Collections.emptyList(); private List startString = Collections.emptyList(); + private List cancelString = Collections.emptyList(); + private List expiryString = Collections.emptyList(); private List startCommands = Collections.emptyList(); private List cancelCommands = Collections.emptyList(); private List expiryCommands = Collections.emptyList(); @@ -356,6 +380,16 @@ public class Quest implements Comparable { return this; } + public Builder withCancelString(List cancelString) { + this.cancelString = cancelString; + return this; + } + + public Builder withExpiryString(List expiryString) { + this.expiryString = expiryString; + return this; + } + public Builder withStartCommands(List startCommands) { this.startCommands = startCommands; return this; @@ -443,6 +477,8 @@ public class Quest implements Comparable { quest.requirements = this.requirements; quest.rewardString = this.rewardString; quest.startString = this.startString; + quest.cancelString = this.cancelString; + quest.expiryString = this.expiryString; quest.startCommands = this.startCommands; quest.cancelCommands = this.cancelCommands; quest.expiryCommands = this.expiryCommands; @@ -459,9 +495,7 @@ public class Quest implements Comparable { quest.placeholders = this.placeholders; quest.progressPlaceholders = this.progressPlaceholders; quest.categoryid = this.categoryid; - return quest; } - } } -- cgit v1.2.3-70-g09d2