diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2021-04-10 17:58:39 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2021-04-12 23:35:07 +0200 |
commit | 3001e23e8cf517de39085f33db170da37df24b17 (patch) | |
tree | ebe073c108753ea9ea95e39406f052643a672af0 /src/Entities/Player.cpp | |
parent | cPlayer: move some constants out of header (diff) | |
download | cuberite-3001e23e8cf517de39085f33db170da37df24b17.tar cuberite-3001e23e8cf517de39085f33db170da37df24b17.tar.gz cuberite-3001e23e8cf517de39085f33db170da37df24b17.tar.bz2 cuberite-3001e23e8cf517de39085f33db170da37df24b17.tar.lz cuberite-3001e23e8cf517de39085f33db170da37df24b17.tar.xz cuberite-3001e23e8cf517de39085f33db170da37df24b17.tar.zst cuberite-3001e23e8cf517de39085f33db170da37df24b17.zip |
Diffstat (limited to 'src/Entities/Player.cpp')
-rw-r--r-- | src/Entities/Player.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
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(); } @@ -2589,22 +2591,13 @@ void cPlayer::AttachTo(cEntity * a_AttachTo) void cPlayer::Detach() { - Detach(false); -} - - - - - -void cPlayer::Detach(bool a_IsTeleporting) -{ if (m_AttachedTo == nullptr) { // The player is not attached to anything. Bail out. 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; } |