PaperMC/patches/server-unmapped/0113-Remove-FishingHook-reference-on-Craft-Entity-removal.patch
2021-06-11 14:02:28 +02:00

25 lines
1,021 B
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 16 Jun 2016 00:17:23 -0400
Subject: [PATCH] Remove FishingHook reference on Craft Entity removal
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
index 4dd3deaabfdb383ded92920e1a313b61a1b9262b..4805bce05f2856289608f45df4fca322de161b31 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
@@ -119,4 +119,14 @@ public class CraftFishHook extends CraftProjectile implements FishHook {
public HookState getState() {
return HookState.values()[getHandle().hookState.ordinal()];
}
+
+ // Paper start
+ @Override
+ public void remove() {
+ super.remove();
+ if (getHandle().getOwner() != null) {
+ getHandle().getOwner().hookedFish = null;
+ }
+ }
+ // Paper end
}