summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/net/minecraft/server/EntityPlayer.java7
-rw-r--r--src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java4
2 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 799aae64..3c944a9b 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -12,6 +12,7 @@ import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
+import org.bukkit.event.entity.PlayerDeathEvent;
// CraftBukkit end
public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -139,7 +140,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void die(DamageSource damagesource) {
- this.b.serverConfigurationManager.sendAll(new Packet3Chat(damagesource.a(this)));
// CraftBukkit start
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
@@ -155,7 +155,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
- CraftEventFactory.callPlayerDeathEvent(this, loot);
+ PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, damagesource.a(this));
+ if (!"".equals(event.getDeathMessage())) {
+ this.b.serverConfigurationManager.sendAll(new Packet3Chat(event.getDeathMessage()));
+ }
// CraftBukkit - we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
for (int i = 0; i < this.inventory.items.length; ++i) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 0082526c..f86dded7 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -293,9 +293,9 @@ public class CraftEventFactory {
return event;
}
- public static PlayerDeathEvent callPlayerDeathEvent(EntityPlayer victim, List<org.bukkit.inventory.ItemStack> drops) {
+ public static PlayerDeathEvent callPlayerDeathEvent(EntityPlayer victim, List<org.bukkit.inventory.ItemStack> drops, String deathMessage) {
CraftPlayer entity = (CraftPlayer)victim.getBukkitEntity();
- PlayerDeathEvent event = new PlayerDeathEvent(entity, drops, victim.getExpReward(), 0);
+ PlayerDeathEvent event = new PlayerDeathEvent(entity, drops, victim.getExpReward(), 0, deathMessage);
org.bukkit.World world = entity.getWorld();
Bukkit.getServer().getPluginManager().callEvent(event);