2013-03-15 10:49:12 +01:00
|
|
|
From ac384dd63995c6eb516756b2b0c0b93712038c84 Mon Sep 17 00:00:00 2001
|
2013-03-04 08:49:59 +01:00
|
|
|
From: md_5 <md_5@live.com.au>
|
|
|
|
Date: Mon, 4 Mar 2013 18:45:52 +1100
|
|
|
|
Subject: [PATCH] PlayerItemDamageEvent
|
|
|
|
|
|
|
|
---
|
|
|
|
src/main/java/net/minecraft/server/ItemStack.java | 11 ++++++++++-
|
|
|
|
1 file changed, 10 insertions(+), 1 deletion(-)
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
|
2013-03-15 10:49:12 +01:00
|
|
|
index 3043db9..e3db554 100644
|
2013-03-04 08:49:59 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/ItemStack.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ItemStack.java
|
|
|
|
@@ -161,7 +161,16 @@ public final class ItemStack {
|
|
|
|
}
|
|
|
|
|
|
|
|
i -= k;
|
|
|
|
- if (i <= 0) {
|
|
|
|
+ // Spigot start
|
|
|
|
+ if (entityliving instanceof EntityPlayer) {
|
|
|
|
+ org.bukkit.craftbukkit.inventory.CraftItemStack item = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(this);
|
2013-03-04 21:22:03 +01:00
|
|
|
+ org.bukkit.event.player.PlayerItemDamageEvent event = new org.bukkit.event.player.PlayerItemDamageEvent((org.bukkit.entity.Player) entityliving.getBukkitEntity(), item, i);
|
2013-03-04 08:49:59 +01:00
|
|
|
+ org.bukkit.Bukkit.getServer().getPluginManager().callEvent(event);
|
|
|
|
+ if (event.isCancelled()) return;
|
|
|
|
+ i = event.getDamage();
|
|
|
|
+ }
|
|
|
|
+ // Spigot end
|
|
|
|
+ if (i <= 0 ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--
|
|
|
|
1.8.1-rc2
|
|
|
|
|