summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-08-16 18:44:14 +0200
committerHowaner <franzi.moos@googlemail.com>2014-08-16 18:44:14 +0200
commita68c70c900d0f3b3842d78af49423890f29af180 (patch)
treed50bfee78da1af28f1e287c3aee5038f705aae0c /src/Entities
parentMerge pull request #1308 from mc-server/logger (diff)
downloadcuberite-a68c70c900d0f3b3842d78af49423890f29af180.tar
cuberite-a68c70c900d0f3b3842d78af49423890f29af180.tar.gz
cuberite-a68c70c900d0f3b3842d78af49423890f29af180.tar.bz2
cuberite-a68c70c900d0f3b3842d78af49423890f29af180.tar.lz
cuberite-a68c70c900d0f3b3842d78af49423890f29af180.tar.xz
cuberite-a68c70c900d0f3b3842d78af49423890f29af180.tar.zst
cuberite-a68c70c900d0f3b3842d78af49423890f29af180.zip
Diffstat (limited to 'src/Entities')
-rw-r--r--src/Entities/Player.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 4398a5bf3..ab4ff3161 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -225,16 +225,24 @@ void cPlayer::Tick(float a_Dt, cChunk & a_Chunk)
SendExperience();
}
+ bool CanMove = true;
if (!GetPosition().EqualsEps(m_LastPos, 0.01)) // Non negligible change in position from last tick?
{
// Apply food exhaustion from movement:
ApplyFoodExhaustionFromMovement();
- cRoot::Get()->GetPluginManager()->CallHookPlayerMoving(*this);
+ if (cRoot::Get()->GetPluginManager()->CallHookPlayerMoving(*this, m_LastPos, GetPosition()))
+ {
+ CanMove = false;
+ TeleportToCoords(m_LastPos.x, m_LastPos.y, m_LastPos.z);
+ }
m_ClientHandle->StreamChunks();
}
- BroadcastMovementUpdate(m_ClientHandle);
+ if (CanMove)
+ {
+ BroadcastMovementUpdate(m_ClientHandle);
+ }
if (m_Health > 0) // make sure player is alive
{