summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-02-09 09:36:42 +0100
committermadmaxoft <github@xoft.cz>2014-02-09 09:36:42 +0100
commita184d592097c24c8796e8680e2ef7fdfe081305d (patch)
tree20df62dcde07191f927d9df8916375a25c8ccc87 /src/Entities/Player.cpp
parentMoved a forgotten comment back to its place. (diff)
parentMerge branch 'master' into playerimprovements (diff)
downloadcuberite-a184d592097c24c8796e8680e2ef7fdfe081305d.tar
cuberite-a184d592097c24c8796e8680e2ef7fdfe081305d.tar.gz
cuberite-a184d592097c24c8796e8680e2ef7fdfe081305d.tar.bz2
cuberite-a184d592097c24c8796e8680e2ef7fdfe081305d.tar.lz
cuberite-a184d592097c24c8796e8680e2ef7fdfe081305d.tar.xz
cuberite-a184d592097c24c8796e8680e2ef7fdfe081305d.tar.zst
cuberite-a184d592097c24c8796e8680e2ef7fdfe081305d.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/Player.cpp41
1 files changed, 26 insertions, 15 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index bea8def9e..286d43cf6 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -3,7 +3,6 @@
#include "Player.h"
#include "../Server.h"
-#include "../ClientHandle.h"
#include "../UI/Window.h"
#include "../UI/WindowOwner.h"
#include "../World.h"
@@ -130,9 +129,13 @@ cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName)
cPlayer::~cPlayer(void)
{
- cRoot::Get()->GetPluginManager()->CallHookPlayerDestroyed(*this);
+ if (!cRoot::Get()->GetPluginManager()->CallHookPlayerDestroyed(*this))
+ {
+ cRoot::Get()->BroadcastChatLeave(Printf("%s has left the game", GetName().c_str()));
+ LOGINFO("Player %s has left the game.", GetName().c_str());
+ }
- LOGD("Deleting cPlayer \"%s\" at %p, ID %d", m_PlayerName.c_str(), this, GetUniqueID());
+ LOGD("Deleting cPlayer \"%s\" at %p, ID %d", GetName().c_str(), this, GetUniqueID());
// Notify the server that the player is being destroyed
cRoot::Get()->GetServer()->PlayerDestroying(this);
@@ -841,18 +844,18 @@ void cPlayer::KilledBy(cEntity * a_Killer)
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()));
+ GetWorld()->BroadcastChatDeath(Printf("%s was killed by environmental damage", 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()));
+ GetWorld()->BroadcastChatDeath(Printf("%s was killed by %s", 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()));
+ GetWorld()->BroadcastChatDeath(Printf("%s was killed by a %s", GetName().c_str(), KillerClass.c_str()));
}
class cIncrementCounterCB
@@ -1117,15 +1120,6 @@ void cPlayer::SetIP(const AString & a_IP)
-void cPlayer::SendMessage(const AString & a_Message)
-{
- m_ClientHandle->SendChat(a_Message);
-}
-
-
-
-
-
void cPlayer::TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ)
{
SetPosition( a_PosX, a_PosY, a_PosZ );
@@ -1741,6 +1735,23 @@ void cPlayer::UseEquippedItem(void)
+void cPlayer::TickBurning(cChunk & a_Chunk)
+{
+ // Don't burn in creative and stop burning in creative if necessary
+ if (!IsGameModeCreative())
+ {
+ super::TickBurning(a_Chunk);
+ }
+ else if (IsOnFire())
+ {
+ m_TicksLeftBurning = 0;
+ OnFinishedBurning();
+ }
+}
+
+
+
+
void cPlayer::HandleFood(void)
{