Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package net.minecraft.server;
2
3import org.bukkit.event.player.PlayerFishEvent;
4
5public class ItemFishingRod extends Item {
6
7 public ItemFishingRod(int i) {
8 super(i);
9 this.d(64);
10 this.c(1);
11 }
12
13 public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
14 if (entityhuman.hookedFish != null) {
15 int i = entityhuman.hookedFish.h();
16
17 itemstack.damage(i, entityhuman);
18 entityhuman.w();
19 } else {
20 // CraftBukkit start
21 PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, PlayerFishEvent.State.FISHING);
22 world.getServer().getPluginManager().callEvent(playerFishEvent);
23
24 if (playerFishEvent.isCancelled()) {
25 return itemstack;
26 }
27 // CraftBukkit end
28 world.makeSound(entityhuman, "random.bow", 0.5F, 0.4F / (b.nextFloat() * 0.4F + 0.8F));
29 if (!world.isStatic) {
30 world.addEntity(new EntityFish(world, entityhuman));
31 }
32
33 entityhuman.w();
34 }
35
36 return itemstack;
37 }
38}