summaryrefslogtreecommitdiffstats
path: root/src/main/java/net
diff options
context:
space:
mode:
authorRigby <rigby@onarandombox.com>2011-09-21 16:32:37 +0100
committerDinnerbone <dinnerbone@dinnerbone.com>2011-09-21 16:55:27 +0100
commit1da2d1f5b619706ae64f317fe9a822e4ab9efeaf (patch)
tree01762edffc14b8a803753f002d3747bebecae787 /src/main/java/net
parent59908c43c99ffc85d60e44dfab56212126a6bcd3 (diff)
downloadcraftbukkit-1da2d1f5b619706ae64f317fe9a822e4ab9efeaf.tar
craftbukkit-1da2d1f5b619706ae64f317fe9a822e4ab9efeaf.tar.gz
craftbukkit-1da2d1f5b619706ae64f317fe9a822e4ab9efeaf.tar.lz
craftbukkit-1da2d1f5b619706ae64f317fe9a822e4ab9efeaf.tar.xz
craftbukkit-1da2d1f5b619706ae64f317fe9a822e4ab9efeaf.zip
Implements the ability to customise and remove Player death messages.
Diffstat (limited to 'src/main/java/net')
-rw-r--r--src/main/java/net/minecraft/server/EntityPlayer.java7
1 files changed, 5 insertions, 2 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) {