Commits

md_5 authored dcc45717b98
SPIGOT-1751: Add missed PlayerFishEvent for FAILED_ATTEMPT
No tags

nms-patches/EntityFishingHook.patch

Modified
70 70 + playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1);
71 71 + this.world.getServer().getPluginManager().callEvent(playerFishEvent);
72 72 +
73 73 + if (playerFishEvent.isCancelled()) {
74 74 + return 0;
75 75 + }
76 76 + // CraftBukkit end
77 77 double d0 = this.owner.locX - this.locX;
78 78 double d1 = this.owner.locY - this.locY;
79 79 double d2 = this.owner.locZ - this.locZ;
80 -@@ -410,13 +445,25 @@
80 +@@ -410,15 +445,36 @@
81 81 entityitem.motY = d1 * d4 + (double) MathHelper.sqrt(d3) * 0.08D;
82 82 entityitem.motZ = d2 * d4;
83 83 this.world.addEntity(entityitem);
84 84 - this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX, this.owner.locY + 0.5D, this.owner.locZ + 0.5D, this.random.nextInt(6) + 1));
85 85 + // CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop()
86 86 + if (playerFishEvent.getExpToDrop() > 0) {
87 87 + this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX, this.owner.locY + 0.5D, this.owner.locZ + 0.5D, playerFishEvent.getExpToDrop()));
88 88 + }
89 89 + // CraftBukkit end
90 90 }
96 96 + // CraftBukkit start
97 97 + PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, (Fish) this.getBukkitEntity(), PlayerFishEvent.State.IN_GROUND);
98 98 + this.world.getServer().getPluginManager().callEvent(playerFishEvent);
99 99 +
100 100 + if (playerFishEvent.isCancelled()) {
101 101 + return 0;
102 102 + }
103 103 + // CraftBukkit end
104 104 i = 2;
105 105 }
106 ++ // CraftBukkit start
107 ++ if (i == 0) {
108 ++ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, (Fish) this.getBukkitEntity(), PlayerFishEvent.State.FAILED_ATTEMPT);
109 ++ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
110 ++ if (playerFishEvent.isCancelled()) {
111 ++ return 0;
112 ++ }
113 ++ }
114 ++ // CraftBukkit end
106 115
116 + this.die();
117 + this.owner.hookedFish = null;

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut