summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ClientHandle.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 10fc66b21..8a45b0d6d 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -124,7 +124,6 @@ cClientHandle::~cClientHandle()
{
RemoveFromAllChunks();
m_Player->GetWorld()->RemoveClientFromChunkSender(this);
- m_Player->SetIsTicking(false);
if (!m_Username.empty())
{
// Send the Offline PlayerList packet:
@@ -174,6 +173,8 @@ void cClientHandle::Destroy(void)
cWorld * World = m_Player->GetWorld();
if (World != nullptr)
{
+ m_Player->StopEveryoneFromTargetingMe();
+ m_Player->SetIsTicking(false);
World->RemovePlayer(m_Player, true);
}
m_Player->RemoveClientHandle();
@@ -3084,7 +3085,7 @@ void cClientHandle::SocketClosed(void)
}
if (m_Player != nullptr)
{
- m_Player->GetWorld()->ScheduleTask(1, [this](cWorld & World)
+ m_Player->GetWorld()->QueueTask([this](cWorld & World)
{
UNUSED(World);
Destroy();