Fix swim stamina cost (#2287)

This commit is contained in:
Thoronium 2023-08-06 22:25:59 -06:00 committed by GitHub
parent 8291e366b9
commit 58d2650505
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -389,6 +389,9 @@ public class StaminaManager extends BasePlayerManager {
return;
}
// Update previous motion state
this.previousState = currentState;
// Update the current state.
this.currentState = motionState;
// logger.trace(currentState + "\t" + (notifyEntityId == currentAvatarEntityId ? "character" : "vehicle"));
@ -417,6 +420,11 @@ public class StaminaManager extends BasePlayerManager {
// Internal handler
private void handleImmediateStamina(GameSession session, @NotNull MotionState motionState) {
// Don't double dip on sustained stamina start costs
if (previousState == currentState) {
return;
}
switch (motionState) {
case MOTION_STATE_CLIMB ->
updateStaminaRelative(session, new Consumption(ConsumptionType.CLIMB_START), true);