Commits

Thinkofname authored 889a5eca6e2
SPIGOT-782: Don't drop exp if a plugin sets it to zero
No tags

nms-patches/EntityFishingHook.patch

Modified
1 ---- /home/matt/mc-dev-private//net/minecraft/server/EntityFishingHook.java 2015-02-26 22:40:22.543608140 +0000
2 -+++ src/main/java/net/minecraft/server/EntityFishingHook.java 2015-02-26 22:40:22.543608140 +0000
1 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityFishingHook.java 2015-04-13 11:24:54.120016726 +0100
2 ++++ src/main/java/net/minecraft/server/EntityFishingHook.java 2015-04-13 11:24:54.120016726 +0100
3 3 @@ -3,6 +3,12 @@
4 4 import java.util.Arrays;
5 5 import java.util.List;
6 6
7 7 +// CraftBukkit start
8 8 +import org.bukkit.entity.Player;
9 9 +import org.bukkit.entity.Fish;
10 10 +import org.bukkit.event.player.PlayerFishEvent;
11 11 +// CraftBukkit end
12 12 +
46 46 + playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1);
47 47 + this.world.getServer().getPluginManager().callEvent(playerFishEvent);
48 48 +
49 49 + if (playerFishEvent.isCancelled()) {
50 50 + return 0;
51 51 + }
52 52 + // CraftBukkit end
53 53 double d5 = this.owner.locX - this.locX;
54 54 double d6 = this.owner.locY - this.locY;
55 55 double d7 = this.owner.locZ - this.locZ;
56 -@@ -403,14 +428,33 @@
56 +@@ -403,14 +428,35 @@
57 57 entityitem.motY = d6 * d9 + (double) MathHelper.sqrt(d8) * 0.08D;
58 58 entityitem.motZ = d7 * d9;
59 59 this.world.addEntity(entityitem);
60 60 - 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));
61 -+ // CraftBukkit - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop()
61 ++ // CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop()
62 ++ if (playerFishEvent.getExpToDrop() > 0) {
62 63 + this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX, this.owner.locY + 0.5D, this.owner.locZ + 0.5D, playerFishEvent.getExpToDrop()));
64 ++ } // CraftBukkit end
63 65 b0 = 1;
64 66 }
65 67
66 68 if (this.as) {
67 69 + // CraftBukkit start
68 70 + PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, (Fish) this.getBukkitEntity(), PlayerFishEvent.State.IN_GROUND);
69 71 + this.world.getServer().getPluginManager().callEvent(playerFishEvent);
70 72 +
71 73 + if (playerFishEvent.isCancelled()) {
72 74 + return 0;

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

Add shortcut