diff options
Diffstat (limited to 'nms-patches/ItemFishingRod.patch')
-rw-r--r-- | nms-patches/ItemFishingRod.patch | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/nms-patches/ItemFishingRod.patch b/nms-patches/ItemFishingRod.patch index b3efc66c..0c8cee22 100644 --- a/nms-patches/ItemFishingRod.patch +++ b/nms-patches/ItemFishingRod.patch @@ -8,23 +8,23 @@ public class ItemFishingRod extends Item { public ItemFishingRod() { -@@ -17,9 +19,18 @@ +@@ -19,9 +21,18 @@ itemstack.damage(i, entityhuman); entityhuman.a(enumhand); } else { -+ // CraftBukkit start -+ EntityFishingHook hook = new EntityFishingHook(world, entityhuman); -+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, (org.bukkit.entity.Fish) hook.getBukkitEntity(), PlayerFishEvent.State.FISHING); -+ world.getServer().getPluginManager().callEvent(playerFishEvent); -+ -+ if (playerFishEvent.isCancelled()) { -+ return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack); -+ } -+ // CraftBukkit end - world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.H, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.j.nextFloat() * 0.4F + 0.8F)); +- world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.I, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.j.nextFloat() * 0.4F + 0.8F)); if (!world.isClientSide) { -- world.addEntity(new EntityFishingHook(world, entityhuman)); -+ world.addEntity(hook); // CraftBukkit - moved creation up - } ++ // CraftBukkit start + EntityFishingHook entityfishinghook = new EntityFishingHook(world, entityhuman); ++ PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, (org.bukkit.entity.Fish) entityfishinghook.getBukkitEntity(), PlayerFishEvent.State.FISHING); ++ world.getServer().getPluginManager().callEvent(playerFishEvent); ++ ++ if (playerFishEvent.isCancelled()) { ++ entityhuman.hookedFish = null; ++ return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack); ++ } ++ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.I, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.j.nextFloat() * 0.4F + 0.8F)); ++ // CraftBukkit end - entityhuman.a(enumhand); + world.addEntity(entityfishinghook); + } |