summaryrefslogtreecommitdiffstats
path: root/bukkit/src
diff options
context:
space:
mode:
Diffstat (limited to 'bukkit/src')
-rw-r--r--bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/dependent/CitizensDeliverTaskType.java36
1 files changed, 22 insertions, 14 deletions
diff --git a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/dependent/CitizensDeliverTaskType.java b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/dependent/CitizensDeliverTaskType.java
index e876b5be..7f9c4b62 100644
--- a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/dependent/CitizensDeliverTaskType.java
+++ b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/dependent/CitizensDeliverTaskType.java
@@ -123,6 +123,9 @@ public final class CitizensDeliverTaskType extends BukkitTaskType {
fixedQuestItemCache.put(quest.getId(), task.getId(), qi);
}
+ int[] amountPerSlot = getAmountsPerSlot(player, qi);
+ int total = Math.min(amountPerSlot[36], amount);
+
int progress;
if (taskProgress.getProgress() == null) {
progress = 0;
@@ -130,25 +133,30 @@ public final class CitizensDeliverTaskType extends BukkitTaskType {
progress = (int) taskProgress.getProgress();
}
- int deficit = amount - progress;
+ if (allowPartial) {
+ if (total == 0) {
+ continue;
+ }
- int[] amountPerSlot = getAmountsPerSlot(player, qi);
- int total = Math.min(amountPerSlot[36], deficit);
+ progress += total;
- if (total == 0) {
- continue;
- }
+ // We must ALWAYS remove items if partial completion is allowed
+ // https://github.com/LMBishop/Quests/issues/375
+ removeItemsInSlots(player, amountPerSlot, total);
- progress += total;
- taskProgress.setProgress(progress);
+ taskProgress.setProgress(progress);
+ if (progress >= amount) {
+ taskProgress.setCompleted(true);
+ }
+ } else {
+ taskProgress.setProgress(total);
+ if (total >= amount) {
+ taskProgress.setCompleted(true);
- if (progress >= amount) {
- taskProgress.setCompleted(true);
- if (remove) {
- removeItemsInSlots(player, amountPerSlot, total);
+ if (remove) {
+ removeItemsInSlots(player, amountPerSlot, total);
+ }
}
- } else if (remove && allowPartial) {
- removeItemsInSlots(player, amountPerSlot, total);
}
}
}