summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEvilSeph <evilseph@unaligned.org>2011-06-07 01:00:30 -0400
committerEvilSeph <evilseph@unaligned.org>2011-06-07 01:00:30 -0400
commit6bd509ebdeb82ccf704f68b62dbbd691c9bc1d10 (patch)
tree733b0dac0c1602632fdd44646e57e75767c66978 /src
parentef9295707aaf3abde7cb44c51ebf67b272f202d2 (diff)
downloadcraftbukkit-6bd509ebdeb82ccf704f68b62dbbd691c9bc1d10.tar
craftbukkit-6bd509ebdeb82ccf704f68b62dbbd691c9bc1d10.tar.gz
craftbukkit-6bd509ebdeb82ccf704f68b62dbbd691c9bc1d10.tar.lz
craftbukkit-6bd509ebdeb82ccf704f68b62dbbd691c9bc1d10.tar.xz
craftbukkit-6bd509ebdeb82ccf704f68b62dbbd691c9bc1d10.zip
Fixed durability changing regardless of whether or not damage was successful. Thanks Xolsom!
Note: Plugins may need to update the client to keep it in synch.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/net/minecraft/server/EntityHuman.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 713b973e..1926bf59 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -534,7 +534,12 @@ public abstract class EntityHuman extends EntityLiving {
}
// CraftBukkit end
- entity.damageEntity(this, i);
+ // CraftBukkit start - Return when the damage fails so that the item will not lose durability
+ if (!entity.damageEntity(this, i)) {
+ return;
+ }
+ // CraftBukkit end
+
ItemStack itemstack = this.F();
if (itemstack != null && entity instanceof EntityLiving) {