diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-12-26 15:55:19 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-12-26 15:55:19 +0100 |
commit | f1142af455eea674c07ab426fe5ef7d4302b16c9 (patch) | |
tree | 6875113e09d39729732b733ae53e220c155cf410 /src/Entities | |
parent | Merge pull request #472 from mc-server/Extreme_Hills_M (diff) | |
download | cuberite-f1142af455eea674c07ab426fe5ef7d4302b16c9.tar cuberite-f1142af455eea674c07ab426fe5ef7d4302b16c9.tar.gz cuberite-f1142af455eea674c07ab426fe5ef7d4302b16c9.tar.bz2 cuberite-f1142af455eea674c07ab426fe5ef7d4302b16c9.tar.lz cuberite-f1142af455eea674c07ab426fe5ef7d4302b16c9.tar.xz cuberite-f1142af455eea674c07ab426fe5ef7d4302b16c9.tar.zst cuberite-f1142af455eea674c07ab426fe5ef7d4302b16c9.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Player.cpp | 16 |
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())); + } } |