diff options
author | Nounours Heureux <schtroumps31@gmail.com> | 2015-06-02 17:06:18 +0200 |
---|---|---|
committer | Nounours Heureux <schtroumps31@gmail.com> | 2015-06-13 10:00:31 +0200 |
commit | d79f601d5a62f2291615955fac196dbab5caa15a (patch) | |
tree | 888f41c63844b9bd0336f9ef0ed585aa6a635883 /src/Entities/Player.cpp | |
parent | NetherPortalScanner: Fixed type conversion warnings. (diff) | |
download | cuberite-d79f601d5a62f2291615955fac196dbab5caa15a.tar cuberite-d79f601d5a62f2291615955fac196dbab5caa15a.tar.gz cuberite-d79f601d5a62f2291615955fac196dbab5caa15a.tar.bz2 cuberite-d79f601d5a62f2291615955fac196dbab5caa15a.tar.lz cuberite-d79f601d5a62f2291615955fac196dbab5caa15a.tar.xz cuberite-d79f601d5a62f2291615955fac196dbab5caa15a.tar.zst cuberite-d79f601d5a62f2291615955fac196dbab5caa15a.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Player.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 0ca560d75..97e2eca3a 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -920,11 +920,11 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI) { Pickups.Add(cItem(E_ITEM_RED_APPLE)); } - m_Stats.AddValue(statItemsDropped, (StatValue)Pickups.Size()); m_World->SpawnItemPickups(Pickups, GetPosX(), GetPosY(), GetPosZ(), 10); SaveToDisk(); // Save it, yeah the world is a tough place ! + cPluginManager * PluginManager = cRoot::Get()->GetPluginManager(); if ((a_TDI.Attacker == nullptr) && m_World->ShouldBroadcastDeathMessages()) { @@ -950,7 +950,12 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI) case dtExplosion: DamageText = "blew up"; break; default: DamageText = "died, somehow; we've no idea how though"; break; } - GetWorld()->BroadcastChatDeath(Printf("%s %s", GetName().c_str(), DamageText.c_str())); + AString DeathMessage = Printf("%s %s", GetName().c_str(), DamageText.c_str()); + PluginManager->CallHookKilled(*this, a_TDI, DeathMessage); + if (DeathMessage != AString("")) + { + GetWorld()->BroadcastChatDeath(DeathMessage); + } } else if (a_TDI.Attacker == nullptr) // && !m_World->ShouldBroadcastDeathMessages() by fallthrough { @@ -959,15 +964,23 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI) else if (a_TDI.Attacker->IsPlayer()) { cPlayer * Killer = (cPlayer *)a_TDI.Attacker; - - GetWorld()->BroadcastChatDeath(Printf("%s was killed by %s", GetName().c_str(), Killer->GetName().c_str())); + AString DeathMessage = Printf("%s was killed by %s", GetName().c_str(), Killer->GetName().c_str()); + PluginManager->CallHookKilled(*this, a_TDI, DeathMessage); + if (DeathMessage != AString("")) + { + GetWorld()->BroadcastChatDeath(DeathMessage); + } } else { AString KillerClass = a_TDI.Attacker->GetClass(); KillerClass.erase(KillerClass.begin()); // Erase the 'c' of the class (e.g. "cWitch" -> "Witch") - - GetWorld()->BroadcastChatDeath(Printf("%s was killed by a %s", GetName().c_str(), KillerClass.c_str())); + AString DeathMessage = Printf("%s was killed by a %s", GetName().c_str(), KillerClass.c_str()); + PluginManager->CallHookKilled(*this, a_TDI, DeathMessage); + if (DeathMessage != AString("")) + { + GetWorld()->BroadcastChatDeath(DeathMessage); + } } m_Stats.AddValue(statDeaths); |