aboutsummaryrefslogtreecommitdiffstats
path: root/bukkit/src
diff options
context:
space:
mode:
authorKrakenied <Krakenied1@gmail.com>2024-06-12 00:00:49 +0200
committerKrakenied <46192742+Krakenied@users.noreply.github.com>2024-08-28 11:37:11 +0200
commit22d882e5ba4e2bb2b26660d19fd0c660959a712f (patch)
tree56bfcb728e6157c3b448114cefc81d4baf9f8d20 /bukkit/src
parent9ba363711c6539981a238bd2230b22e9f54c06ec (diff)
Do not send track advancement for inventory task if progress didn't change
Diffstat (limited to 'bukkit/src')
-rw-r--r--bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/InventoryTaskType.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/InventoryTaskType.java b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/InventoryTaskType.java
index 969c8c29..81ebf24e 100644
--- a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/InventoryTaskType.java
+++ b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/InventoryTaskType.java
@@ -151,6 +151,15 @@ public final class InventoryTaskType extends BukkitTaskType {
}
} else {
int progress = Math.min(amountPerSlot[36], amount);
+ int oldProgress = TaskUtils.getIntegerTaskProgress(taskProgress);
+
+ if (progress == oldProgress) {
+ // no need to update, also no need to check for progress >= amount
+ // as quest completer will handle that properly after some time
+ // we don't want to send track advancement for each inventory op too
+ continue;
+ }
+
taskProgress.setProgress(progress);
super.debug("Updating task progress (now " + progress + ")", quest.getId(), task.getId(), player.getUniqueId());