summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-12-27 11:53:12 +0100
committermadmaxoft <github@xoft.cz>2013-12-27 11:53:12 +0100
commit90213d324a8fa56ddfb1ea9ce9d19842b1663712 (patch)
treecf7701d29db0e5f417c66b770ee75075a2cb0857 /src/Entities
parentMade cmake compilation possible on Windows. (diff)
parentMerge pull request #476 from mc-server/apidump-writingplugin (diff)
downloadcuberite-90213d324a8fa56ddfb1ea9ce9d19842b1663712.tar
cuberite-90213d324a8fa56ddfb1ea9ce9d19842b1663712.tar.gz
cuberite-90213d324a8fa56ddfb1ea9ce9d19842b1663712.tar.bz2
cuberite-90213d324a8fa56ddfb1ea9ce9d19842b1663712.tar.lz
cuberite-90213d324a8fa56ddfb1ea9ce9d19842b1663712.tar.xz
cuberite-90213d324a8fa56ddfb1ea9ce9d19842b1663712.tar.zst
cuberite-90213d324a8fa56ddfb1ea9ce9d19842b1663712.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/Player.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 0fa8254ce..67d5a47ef 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -820,6 +820,22 @@ void cPlayer::KilledBy(cEntity * a_Killer)
m_Inventory.Clear();
m_World->SpawnItemPickups(Pickups, GetPosX(), GetPosY(), GetPosZ(), 10);
SaveToDisk(); // Save it, yeah the world is a tough place !
+
+ if (a_Killer == NULL)
+ {
+ GetWorld()->BroadcastChat(Printf("%s[DEATH] %s%s was killed by environmental damage", cChatColor::Red.c_str(), cChatColor::White.c_str(), GetName().c_str()));
+ }
+ else if (a_Killer->IsPlayer())
+ {
+ GetWorld()->BroadcastChat(Printf("%s[DEATH] %s%s was killed by %s", cChatColor::Red.c_str(), cChatColor::White.c_str(), GetName().c_str(), ((cPlayer *)a_Killer)->GetName().c_str()));
+ }
+ else
+ {
+ AString KillerClass = a_Killer->GetClass();
+ KillerClass.erase(KillerClass.begin()); // Erase the 'c' of the class (e.g. "cWitch" -> "Witch")
+
+ GetWorld()->BroadcastChat(Printf("%s[DEATH] %s%s was killed by a %s", cChatColor::Red.c_str(), cChatColor::White.c_str(), GetName().c_str(), KillerClass.c_str()));
+ }
}