Paper/CraftBukkit-Patches/0100-Properly-cancel-fishing-event.-Fixes-BUKKIT-5396.patch
Zach Brown c7f1eed0bf Update from upstream SpigotMC
3beb7729816
a77ed5758a7
52c130fc6d9
2014-12-20 19:09:49 -06:00

27 lines
1.2 KiB
Diff

From bea71ca2de25c9a9a96de4a86bd21c558a872c5f Mon Sep 17 00:00:00 2001
From: "gjmcferrin@gmail.com" <gjmcferrin@gmail.com>
Date: Mon, 10 Feb 2014 10:05:11 -0500
Subject: [PATCH] Properly cancel fishing event. Fixes BUKKIT-5396
Previously, when cancelling a PlayerFishEvent with State.FISHING, the next
fishing attempt would automatically result in a new PlayerFishEvent with
State.FAILED_ATTEMPT because the player's hooked entity was not properly
cleared. This ensures that the player's hooked entity value is set to null so
that the next attempt will result in the proper state being called.
diff --git a/src/main/java/net/minecraft/server/ItemFishingRod.java b/src/main/java/net/minecraft/server/ItemFishingRod.java
index 423a776..c14d261 100644
--- a/src/main/java/net/minecraft/server/ItemFishingRod.java
+++ b/src/main/java/net/minecraft/server/ItemFishingRod.java
@@ -23,6 +23,7 @@ public class ItemFishingRod extends Item {
world.getServer().getPluginManager().callEvent(playerFishEvent);
if (playerFishEvent.isCancelled()) {
+ entityhuman.hookedFish = null;
return itemstack;
}
// CraftBukkit end
--
2.1.0