Fix PlayerFishEvent not properly cancelling. Fixes

BUKKIT-5245,BUKKIT-5396

PlayerFishEvent event states are not properly being cancelled,
the FishingHookEntity being deleted when the event is cancelled,
thus making the event happen. The event states of CAUGHT_ENTITY,
CAUGHT_FISH, FAILED_ATTEMPT, IN_GROUND must keep the
EntityFishingHook alive in order to cancel the event.
Removed the entity despawn lines when event is cancelled
and added a cancelled action for FAILED_ATTEMPT state.
Dieser Commit ist enthalten in:
myiume 2014-04-13 20:13:13 +10:00 committet von md_5
Ursprung 84643687e6
Commit c6140eafcc

Datei anzeigen

@ -0,0 +1,59 @@
From 3d66957961c0ecf777c07789120526eb77f50a42 Mon Sep 17 00:00:00 2001
From: myiume <cursed_kidd@yahoo.com>
Date: Wed, 19 Feb 2014 15:40:37 +0200
Subject: [PATCH] Fix PlayerFishEvent not properly cancelling. Fixes
BUKKIT-5245,BUKKIT-5396
PlayerFishEvent event states are not properly being cancelled,
the FishingHookEntity being deleted when the event is cancelled,
thus making the event happen. The event states of CAUGHT_ENTITY,
CAUGHT_FISH, FAILED_ATTEMPT, IN_GROUND must keep the
EntityFishingHook alive in order to cancel the event.
Removed the entity despawn lines when event is cancelled
and added a cancelled action for FAILED_ATTEMPT state.
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index 2a73b6c..0763dd1 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -370,8 +370,6 @@ public class EntityFishingHook extends Entity {
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
if (playerFishEvent.isCancelled()) {
- this.die();
- this.owner.hookedFish = null;
return 0;
}
// CraftBukkit end
@@ -394,8 +392,6 @@ public class EntityFishingHook extends Entity {
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
if (playerFishEvent.isCancelled()) {
- this.die();
- this.owner.hookedFish = null;
return 0;
}
// CraftBukkit end
@@ -421,8 +417,6 @@ public class EntityFishingHook extends Entity {
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
if (playerFishEvent.isCancelled()) {
- this.die();
- this.owner.hookedFish = null;
return 0;
}
// CraftBukkit end
@@ -434,6 +428,10 @@ public class EntityFishingHook extends Entity {
if (b0 == 0) {
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, (Fish) this.getBukkitEntity(), PlayerFishEvent.State.FAILED_ATTEMPT);
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
+
+ if (playerFishEvent.isCancelled()) {
+ return 0;
+ }
}
// CraftBukkit end
--
1.8.3.2