2013-03-15 21:35:56 +00:00
|
|
|
From 8503226f492fd2dfcff2fd1cbc9b737c71c05fd0 Mon Sep 17 00:00:00 2001
|
2013-03-04 07:49:59 +00: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 21:35:56 +00:00
|
|
|
index cd6dd07..a2df1d5 100644
|
2013-03-04 07:49:59 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/ItemStack.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ItemStack.java
|
2013-03-15 21:35:56 +00:00
|
|
|
@@ -174,7 +174,16 @@ public final class ItemStack {
|
2013-03-04 07:49:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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 20:22:03 +00:00
|
|
|
+ org.bukkit.event.player.PlayerItemDamageEvent event = new org.bukkit.event.player.PlayerItemDamageEvent((org.bukkit.entity.Player) entityliving.getBukkitEntity(), item, i);
|
2013-03-04 07:49:59 +00:00
|
|
|
+ org.bukkit.Bukkit.getServer().getPluginManager().callEvent(event);
|
|
|
|
+ if (event.isCancelled()) return;
|
|
|
|
+ i = event.getDamage();
|
|
|
|
+ }
|
|
|
|
+ // Spigot end
|
|
|
|
+ if (i <= 0 ) {
|
2013-03-15 21:35:56 +00:00
|
|
|
return false;
|
2013-03-04 07:49:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
--
|
|
|
|
1.8.1-rc2
|
|
|
|
|