From 3001e23e8cf517de39085f33db170da37df24b17 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 10 Apr 2021 16:58:39 +0100 Subject: Thrown potions/enderpearls: cleanup --- src/Entities/Player.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'src/Entities/Player.cpp') diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 65fed943b..233c0a8c3 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -1410,9 +1410,11 @@ void cPlayer::TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ) // ask plugins to allow teleport to the new position. if (!cRoot::Get()->GetPluginManager()->CallHookEntityTeleport(*this, m_LastPosition, Vector3d(a_PosX, a_PosY, a_PosZ))) { + m_IsTeleporting = true; + + Detach(); SetPosition({a_PosX, a_PosY, a_PosZ}); FreezeInternal(GetPosition(), false); - m_IsTeleporting = true; m_ClientHandle->SendPlayerMoveLook(); } @@ -2588,15 +2590,6 @@ void cPlayer::AttachTo(cEntity * a_AttachTo) void cPlayer::Detach() -{ - Detach(false); -} - - - - - -void cPlayer::Detach(bool a_IsTeleporting) { if (m_AttachedTo == nullptr) { @@ -2604,7 +2597,7 @@ void cPlayer::Detach(bool a_IsTeleporting) return; } - // Different detach, if this is a spectator + // Different detach, if this is a spectator: if (IsGameModeSpectator()) { GetClientHandle()->SendCameraSetTo(*this); @@ -2615,8 +2608,8 @@ void cPlayer::Detach(bool a_IsTeleporting) Super::Detach(); - // If they are teleporting, no need to figure out position - if (a_IsTeleporting) + // If they are teleporting, no need to figure out position: + if (m_IsTeleporting) { return; } -- cgit v1.2.3