From 14651c1e68cc8ebac4aa598a34f0e50f82fc1921 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Fri, 3 Jun 2016 16:27:25 +1000 Subject: [PATCH] Make unafk instantly when your own rotation changes. --- Commands/Information/CmdAfk.cs | 1 + Player/Player.Handlers.cs | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Commands/Information/CmdAfk.cs b/Commands/Information/CmdAfk.cs index 1c8b5525d..15dabb80e 100644 --- a/Commands/Information/CmdAfk.cs +++ b/Commands/Information/CmdAfk.cs @@ -45,6 +45,7 @@ namespace MCGalaxy.Commands { p.IsAfk = !p.IsAfk; p.afkMessage = p.IsAfk ? message : null; TabList.Update(p, true); + p.LastAction = DateTime.UtcNow; bool send = !Server.chatmod && !p.muted; if (p.IsAfk) { diff --git a/Player/Player.Handlers.cs b/Player/Player.Handlers.cs index ec74e4206..b84fd5e95 100644 --- a/Player/Player.Handlers.cs +++ b/Player/Player.Handlers.cs @@ -755,9 +755,14 @@ return; if (cancelmove) { SendPos(0xFF, pos[0], pos[1], pos[2], rot[0], rot[1]); return; - } + } + pos = new ushort[3] { x, y, z }; rot = new byte[2] { rotx, roty }; + if (!Moved()) return; + + LastAction = DateTime.UtcNow; + if (IsAfk) CmdAfk.ToggleAfk(this, ""); /*if (!CheckIfInsideBlock()) { clippos = pos; cliprot = rot; }*/ }