From d332e77b762dff8c763efb8a2eec51d725f5492b Mon Sep 17 00:00:00 2001 From: gentlespoon Date: Mon, 9 May 2022 01:43:32 -0700 Subject: [PATCH] Only handle motion notify for current entity. --- .../StaminaManager/StaminaManager.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/emu/grasscutter/game/managers/StaminaManager/StaminaManager.java b/src/main/java/emu/grasscutter/game/managers/StaminaManager/StaminaManager.java index 72b91c055..c4b094375 100644 --- a/src/main/java/emu/grasscutter/game/managers/StaminaManager/StaminaManager.java +++ b/src/main/java/emu/grasscutter/game/managers/StaminaManager/StaminaManager.java @@ -243,15 +243,16 @@ public class StaminaManager { cachedEntity = entity; MotionInfo motionInfo = moveInfo.getMotionInfo(); MotionState motionState = motionInfo.getState(); - boolean isReliable = moveInfo.getIsReliable(); - Grasscutter.getLogger().trace("" + motionState + "\t" + (isReliable ? "reliable" : "")); - if (isReliable) { - currentState = motionState; - Vector posVector = motionInfo.getPos(); - Position newPos = new Position(posVector.getX(), posVector.getY(), posVector.getZ()); - if (newPos.getX() != 0 && newPos.getY() != 0 && newPos.getZ() != 0) { - currentCoordinates = newPos; - } + int notifyEntityId = entity.getId(); + int currentAvatarEntityId = session.getPlayer().getTeamManager().getCurrentAvatarEntity().getId(); + if (notifyEntityId != currentAvatarEntityId) { + return; + } + currentState = motionState; + Vector posVector = motionInfo.getPos(); + Position newPos = new Position(posVector.getX(), posVector.getY(), posVector.getZ()); + if (newPos.getX() != 0 && newPos.getY() != 0 && newPos.getZ() != 0) { + currentCoordinates = newPos; } startSustainedStaminaHandler(); handleImmediateStamina(session, motionInfo, motionState, entity);