From 8c144207dc6bcbc9871c3a577b864f7c3fcd074c Mon Sep 17 00:00:00 2001 From: Scott Moore Date: Wed, 8 Apr 2015 00:41:19 +1000 Subject: Implement backend for /title command --- src/ClientHandle.cpp | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 28fccb68e..2ce212421 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -2320,6 +2320,15 @@ void cClientHandle::SendHealth(void) +void cClientHandle::SendHideTitle(void) +{ + m_Protocol->SendHideTitle(); +} + + + + + void cClientHandle::SendInventorySlot(char a_WindowID, short a_SlotNum, const cItem & a_Item) { m_Protocol->SendInventorySlot(a_WindowID, a_SlotNum, a_Item); @@ -2514,6 +2523,15 @@ void cClientHandle::SendRemoveEntityEffect(const cEntity & a_Entity, int a_Effec +void cClientHandle::SendResetTitle() +{ + m_Protocol->SendResetTitle(); +} + + + + + void cClientHandle::SendRespawn(eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) { m_Protocol->SendRespawn(a_Dimension, a_ShouldIgnoreDimensionChecks); @@ -2568,6 +2586,42 @@ void cClientHandle::SendDisplayObjective(const AString & a_Objective, cScoreboar +void cClientHandle::SendSetSubTitle(const cCompositeChat & a_SubTitle) +{ + m_Protocol->SendSetSubTitle(a_SubTitle); +} + + + + + +void cClientHandle::SendSetRawSubTitle(const AString & a_SubTitle) +{ + m_Protocol->SendSetRawSubTitle(a_SubTitle); +} + + + + + +void cClientHandle::SendSetTitle(const cCompositeChat & a_Title) +{ + m_Protocol->SendSetTitle(a_Title); +} + + + + + +void cClientHandle::SendSetRawTitle(const AString & a_Title) +{ + m_Protocol->SendSetRawTitle(a_Title); +} + + + + + void cClientHandle::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) { m_Protocol->SendSoundEffect(a_SoundName, a_X, a_Y, a_Z, a_Volume, a_Pitch); @@ -2658,6 +2712,15 @@ void cClientHandle::SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ) +void cClientHandle::SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) +{ + m_Protocol->SendTitleTimes(a_FadeInTicks, a_DisplayTicks, a_FadeOutTicks); +} + + + + + void cClientHandle::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) { m_Protocol->SendTimeUpdate(a_WorldAge, a_TimeOfDay, a_DoDaylightCycle); -- cgit v1.2.3 From 31b95afd79886a90f7629b0a7038d90790660e7d Mon Sep 17 00:00:00 2001 From: tycho Date: Mon, 25 May 2015 11:10:26 +0100 Subject: Fixed ClientHandle not getting properly removed from the world when socket is closed whilst the client is being added to the world Fixes #1969 --- src/ClientHandle.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 13972b0f5..765ccdee2 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -2957,13 +2957,20 @@ void cClientHandle::PacketError(UInt32 a_PacketType) void cClientHandle::SocketClosed(void) { // The socket has been closed for any reason - + if (!m_Username.empty()) // Ignore client pings { LOGD("Client %s @ %s disconnected", m_Username.c_str(), m_IPString.c_str()); cRoot::Get()->GetPluginManager()->CallHookDisconnect(*this, "Player disconnected"); } - + if (m_State < csDestroying) + { + cWorld * World = m_Player->GetWorld(); + if (World != nullptr) + { + World->RemovePlayer(m_Player, true); // Must be called before cPlayer::Destroy() as otherwise cChunk tries to delete the player, and then we do it again + } + } Destroy(); } -- cgit v1.2.3