mirror of
https://github.com/PaperMC/Paper.git
synced 2024-09-12 15:08:27 +02:00
Fix PlayerFishEvent not correctly cancelling. Fixes BUKKIT-5396
Prior to this commit cancelling the PlayerFishEvent would cause various states of the fishing routine to be incorrectly or wrongly fired. This incorrect behaviour was due to the miscommunication between the server and client regarding the fishing state. When the event was cancelled, the bobber entity was removed and caused the client to incorrectly determine what the "next state" was to logically be. This commit resolves the issue by ensuring the client is made aware of the correct changes at the correct time regarding the bobber entity, therefore keeping the logical steps of "fishing" proper and in-tact.
This commit is contained in:
parent
b3e83b00fc
commit
4507cec090
@ -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,9 @@ 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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user