summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-08-16 22:29:41 +0200
committerMattes D <github@xoft.cz>2014-08-16 22:29:41 +0200
commite045a25e10e1aff47c35fae44c6b585df061c612 (patch)
treeb2c69b5faf2f199e30bdf9c2ee3b6cd76a125ef7 /src/Entities
parentMerge pull request #1308 from mc-server/logger (diff)
parentUpdated HOOK_PLAYER_MOVING documentation. (diff)
downloadcuberite-e045a25e10e1aff47c35fae44c6b585df061c612.tar
cuberite-e045a25e10e1aff47c35fae44c6b585df061c612.tar.gz
cuberite-e045a25e10e1aff47c35fae44c6b585df061c612.tar.bz2
cuberite-e045a25e10e1aff47c35fae44c6b585df061c612.tar.lz
cuberite-e045a25e10e1aff47c35fae44c6b585df061c612.tar.xz
cuberite-e045a25e10e1aff47c35fae44c6b585df061c612.tar.zst
cuberite-e045a25e10e1aff47c35fae44c6b585df061c612.zip
Diffstat (limited to '')
-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
{