aboutsummaryrefslogtreecommitdiffstats
path: root/bukkit
diff options
context:
space:
mode:
authorKrakenied <Krakenied1@gmail.com>2023-05-26 22:45:29 +0200
committerKrakenied <Krakenied1@gmail.com>2023-05-26 22:45:29 +0200
commit7e8328da0a4c4eae394057fdfe35775cdcab4304 (patch)
treec357dc6ccef3d6208fe5e6c1f254b9d614f33312 /bukkit
parenta848ab31f295977b5ef10428fa66ea74e3c34174 (diff)
Add exact match option to brewing task type
Diffstat (limited to 'bukkit')
-rw-r--r--bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/BrewingTaskType.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/BrewingTaskType.java b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/BrewingTaskType.java
index ce4fcfde..7c3dcd8e 100644
--- a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/BrewingTaskType.java
+++ b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/BrewingTaskType.java
@@ -40,6 +40,7 @@ public final class BrewingTaskType extends BukkitTaskType {
super.addConfigValidator(TaskUtils.useIntegerConfigValidator(this, "amount"));
super.addConfigValidator(TaskUtils.useItemStackConfigValidator(this, "ingredient"));
super.addConfigValidator(TaskUtils.useIntegerConfigValidator(this, "data"));
+ super.addConfigValidator(TaskUtils.useBooleanConfigValidator(this, "exact-match"));
}
@Override
@@ -105,18 +106,19 @@ public final class BrewingTaskType extends BukkitTaskType {
super.debug("Player brewed " + eventAmount + " potions" + (ingredient != null ? " using " + ingredient.getType() : ""), quest.getId(), task.getId(), player.getUniqueId());
- if (!qi.compareItemStack(ingredient)) {
+ boolean exactMatch = TaskUtils.getConfigBoolean(task, "exact-match", true);
+ if (!qi.compareItemStack(ingredient, exactMatch)) {
super.debug("Ingredient does not match, continuing...", quest.getId(), task.getId(), player.getUniqueId());
continue;
}
}
- int amount = (int) task.getConfigValue("amount");
-
int progress = TaskUtils.getIntegerTaskProgress(taskProgress);
taskProgress.setProgress(progress + eventAmount);
super.debug("Updating task progress (now " + (progress + eventAmount) + ")", quest.getId(), task.getId(), player.getUniqueId());
+ int amount = (int) task.getConfigValue("amount");
+
if ((int) taskProgress.getProgress() >= amount) {
super.debug("Marking task as complete", quest.getId(), task.getId(), player.getUniqueId());
taskProgress.setProgress(amount);
@@ -124,5 +126,4 @@ public final class BrewingTaskType extends BukkitTaskType {
}
}
}
-
}