From 213ea4a3af987700b84b7eed58fce96f871174b2 Mon Sep 17 00:00:00 2001 From: Woosle Park Date: Thu, 28 Mar 2019 20:43:55 -0400 Subject: [PATCH] execution time added v.2 I noticed I should place the execution time event after the walking action in update --- .../main/java/net/simon987/cubotplugin/Cubot.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Plugin Cubot/src/main/java/net/simon987/cubotplugin/Cubot.java b/Plugin Cubot/src/main/java/net/simon987/cubotplugin/Cubot.java index cbf80ef..1c990b1 100644 --- a/Plugin Cubot/src/main/java/net/simon987/cubotplugin/Cubot.java +++ b/Plugin Cubot/src/main/java/net/simon987/cubotplugin/Cubot.java @@ -173,13 +173,6 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit, Me */ @Override public void update() { - int executionTime = timer.getTime(); - if(executionTime > time && currentAction != Action.IDLE){ - GameEvent event1 = new ExecutionTimeEvent(this, executionTime - time); - GameServer.INSTANCE.getEventDispatcher().dispatch(event1); - } - time = executionTime; - if (currentAction == Action.WALKING) { if (spendEnergy(100)) { if (!incrementLocation()) { @@ -193,6 +186,13 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit, Me currentAction = Action.IDLE; } } + + int executionTime = timer.getTime(); + if(executionTime > time && currentAction != Action.IDLE){ + GameEvent event1 = new ExecutionTimeEvent(this, executionTime - time); + GameServer.INSTANCE.getEventDispatcher().dispatch(event1); + } + time = executionTime; /* * CurrentAction is set during the code execution and this function is called right after