diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/experimental/CoordsLog.java b/src/main/java/me/zeroeightsix/kami/module/modules/experimental/CoordsLog.java index 78debdc84..c5d0e1e1e 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/experimental/CoordsLog.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/experimental/CoordsLog.java @@ -8,7 +8,12 @@ import me.zeroeightsix.kami.util.Coordinate; import static me.zeroeightsix.kami.util.MessageSendHelper.sendChatMessage; -@Module.Info(name = "CoordsLog", description = "Automatically writes the coordinates of the player to a file with a user defined delay between logs.", category = Module.Category.EXPERIMENTAL, showOnArray = Module.ShowOnArray.ON) +@Module.Info( + name = "CoordsLog", + description = "Automatically writes the coordinates of the player to a file with a user defined delay between logs.", + category = Module.Category.EXPERIMENTAL, + showOnArray = Module.ShowOnArray.ON +) public class CoordsLog extends Module { private Setting forceLogOnDeath = register(Settings.b("onDeath", true)); private Setting deathInChat = register(Settings.b("logDeathInChat", true)); @@ -24,20 +29,21 @@ public class CoordsLog extends Module { public void onUpdate() { if (mc.player == null) return; + if (autoLog.getValue()) { timeout(); } + if (0 < mc.player.getHealth() && playerIsDead) { playerIsDead = false; } + if (!playerIsDead && 0 >= mc.player.getHealth() && forceLogOnDeath.getValue()) { Coordinate deathPoint = logCoordinates("deathPoint"); if (deathInChat.getValue()) { sendChatMessage("You died at " + deathPoint.x + " " + deathPoint.y + " " + deathPoint.z); - playerIsDead = true; - } else { - playerIsDead = true; } + playerIsDead = true; } } @@ -46,6 +52,7 @@ public class CoordsLog extends Module { private void timeout() { if (startTime == 0) startTime = System.currentTimeMillis(); + if (startTime + (delay.getValue() * 1000) <= System.currentTimeMillis()) { // 1 timeout = 1 second = 1000 ms startTime = System.currentTimeMillis(); Coordinate pos = CoordUtil.getCurrentCoord();