aboutsummaryrefslogtreecommitdiffstats
path: root/bukkit
diff options
context:
space:
mode:
Diffstat (limited to 'bukkit')
-rw-r--r--bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/BarteringTaskType.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/BarteringTaskType.java b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/BarteringTaskType.java
index b2d4c88c..8186f90a 100644
--- a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/BarteringTaskType.java
+++ b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/BarteringTaskType.java
@@ -28,6 +28,9 @@ import java.util.Map;
import java.util.UUID;
import java.util.WeakHashMap;
+/**
+ * TODO: There is Paper PR to make obtaining the thrower UUID easier: <a href="https://github.com/PaperMC/Paper/pull/5736">Paper#5736</a>
+ */
public final class BarteringTaskType extends BukkitTaskType {
private final BukkitQuestsPlugin plugin;
@@ -60,7 +63,12 @@ public final class BarteringTaskType extends BukkitTaskType {
if (entity instanceof final Piglin piglin) {
final UUID throwerId = event.getItem().getOwner();
- this.piglin2ThrowerIdMap.put(piglin, throwerId);
+
+ if (throwerId != null) {
+ this.piglin2ThrowerIdMap.put(piglin, throwerId);
+ } else {
+ this.piglin2ThrowerIdMap.remove(piglin);
+ }
}
}