diff options
| author | Krakenied <Krakenied1@gmail.com> | 2023-10-11 12:09:07 +0200 |
|---|---|---|
| committer | Leonardo Bishop <13875753+LMBishop@users.noreply.github.com> | 2023-11-26 12:59:38 +0000 |
| commit | 9aa600d33ef7537b472a552601a3b8204ce8a07d (patch) | |
| tree | 6a0f24471aa93a306462c024bf6e1f48cfe25d8d /common/src | |
| parent | 3f2261869686c0c65203a974e1b32c73cb054296 (diff) | |
Add cancel commands
Partially closes https://github.com/LMBishop/Quests/issues/558
Diffstat (limited to 'common/src')
| -rw-r--r-- | common/src/main/java/com/leonardobishop/quests/common/quest/Quest.java | 18 |
1 files changed, 18 insertions, 0 deletions
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 45dfde96..6af3fcf3 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,7 @@ public class Quest implements Comparable<Quest> { private List<String> rewardString; private List<String> startString; private List<String> startCommands; + private List<String> cancelCommands; private boolean repeatEnabled; private boolean cooldownEnabled; private int cooldown; @@ -162,6 +163,16 @@ public class Quest implements Comparable<Quest> { } /** + * Get the cancel commands for this quest. + * The cancel commands is a list of commands to be executed upon cancelling the quest. + * + * @return immutable list of commands + */ + public List<String> getCancelCommands() { + return Collections.unmodifiableList(cancelCommands); + } + + /** * Get if this quest can be repeated after completion. * * @return boolean @@ -294,6 +305,7 @@ public class Quest implements Comparable<Quest> { private List<String> rewardString = Collections.emptyList(); private List<String> startString = Collections.emptyList(); private List<String> startCommands = Collections.emptyList(); + private List<String> cancelCommands = Collections.emptyList(); private boolean repeatEnabled = false; private boolean cooldownEnabled = false; private int cooldown = 0; @@ -337,6 +349,11 @@ public class Quest implements Comparable<Quest> { return this; } + public Builder withCancelCommands(List<String> cancelCommands) { + this.cancelCommands = cancelCommands; + return this; + } + public Builder withSortOrder(int sortOrder) { this.sortOrder = sortOrder; return this; @@ -410,6 +427,7 @@ public class Quest implements Comparable<Quest> { quest.rewardString = this.rewardString; quest.startString = this.startString; quest.startCommands = this.startCommands; + quest.cancelCommands = this.cancelCommands; quest.repeatEnabled = this.repeatEnabled; quest.cooldownEnabled = this.cooldownEnabled; quest.cooldown = this.cooldown; |
