Skip to content

Commit

Permalink
Prepare MovementManager.updateStamina() for external calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlespoon authored and Melledy committed May 7, 2022
1 parent f1f3bad commit 29c5551
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ private int getMaximumStamina() {
return player.getProperty(PlayerProperty.PROP_MAX_STAMINA);
}



// Returns new stamina
public int updateStamina(GameSession session, int amount) {
int currentStamina = session.getPlayer().getProperty(PlayerProperty.PROP_CUR_PERSIST_STAMINA);
Expand All @@ -196,6 +194,7 @@ public int updateStamina(GameSession session, int amount) {
newStamina = playerMaxStamina;
}
session.getPlayer().setProperty(PlayerProperty.PROP_CUR_PERSIST_STAMINA, newStamina);
session.send(new PacketPlayerPropNotify(player, PlayerProperty.PROP_CUR_PERSIST_STAMINA));
return newStamina;
}

Expand Down Expand Up @@ -309,7 +308,6 @@ public void run() {
}
Grasscutter.getLogger().debug(getCurrentStamina() + "/" + getMaximumStamina() + "\t" + currentState + "\t" + "isMoving: " + isPlayerMoving() + "\t(" + consumption.consumptionType + "," + consumption.amount + ")");
updateStamina(cachedSession, consumption.amount);
cachedSession.send(new PacketPlayerPropNotify(player, PlayerProperty.PROP_CUR_PERSIST_STAMINA));
}

// tick triggered
Expand Down

0 comments on commit 29c5551

Please sign in to comment.