From 6bd509ebdeb82ccf704f68b62dbbd691c9bc1d10 Mon Sep 17 00:00:00 2001 From: EvilSeph Date: Tue, 7 Jun 2011 01:00:30 -0400 Subject: [PATCH] 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. --- src/main/java/net/minecraft/server/EntityHuman.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java index 713b973e51..1926bf59e0 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) {