Add FishHookStateChangeEvent (#12165)

This commit is contained in:
Namiu/うにたろう
2025-05-16 03:17:32 +09:00
committed by GitHub
parent a25258190b
commit d683970d40
4 changed files with 80 additions and 0 deletions

View File

@@ -42,6 +42,29 @@
return;
}
} else {
@@ -166,12 +_,14 @@
if (this.currentState == FishingHook.FishHookState.FLYING) {
if (this.hookedIn != null) {
this.setDeltaMovement(Vec3.ZERO);
+ new io.papermc.paper.event.entity.FishHookStateChangeEvent((org.bukkit.entity.FishHook) getBukkitEntity(), org.bukkit.entity.FishHook.HookState.HOOKED_ENTITY).callEvent(); // Paper - Add FishHookStateChangeEvent. #HOOKED_ENTITY
this.currentState = FishingHook.FishHookState.HOOKED_IN_ENTITY;
return;
}
if (flag) {
this.setDeltaMovement(this.getDeltaMovement().multiply(0.3, 0.2, 0.3));
+ new io.papermc.paper.event.entity.FishHookStateChangeEvent((org.bukkit.entity.FishHook) getBukkitEntity(), org.bukkit.entity.FishHook.HookState.BOBBING).callEvent(); // Paper - Add FishHookStateChangeEvent. #BOBBING
this.currentState = FishingHook.FishHookState.BOBBING;
return;
}
@@ -184,6 +_,7 @@
this.setPos(this.hookedIn.getX(), this.hookedIn.getY(0.8), this.hookedIn.getZ());
} else {
this.setHookedEntity(null);
+ new io.papermc.paper.event.entity.FishHookStateChangeEvent((org.bukkit.entity.FishHook) getBukkitEntity(), org.bukkit.entity.FishHook.HookState.UNHOOKED).callEvent(); // Paper - Add FishHookStateChangeEvent. #UNHOOKED
this.currentState = FishingHook.FishHookState.FLYING;
}
}
@@ -247,14 +_,14 @@
if (!player.isRemoved() && player.isAlive() && (isFishingRod || isFishingRod1) && !(this.distanceToSqr(player) > 1024.0)) {
return false;