mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-22 21:56:09 +00:00
Prepare MovementManager.updateStamina() for external calls.
This commit is contained in:
parent
ff52255ac7
commit
9b3ca239c9
@ -179,8 +179,6 @@ public class MovementManager {
|
|||||||
return player.getProperty(PlayerProperty.PROP_MAX_STAMINA);
|
return player.getProperty(PlayerProperty.PROP_MAX_STAMINA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Returns new stamina
|
// Returns new stamina
|
||||||
public int updateStamina(GameSession session, int amount) {
|
public int updateStamina(GameSession session, int amount) {
|
||||||
int currentStamina = session.getPlayer().getProperty(PlayerProperty.PROP_CUR_PERSIST_STAMINA);
|
int currentStamina = session.getPlayer().getProperty(PlayerProperty.PROP_CUR_PERSIST_STAMINA);
|
||||||
@ -196,6 +194,7 @@ public class MovementManager {
|
|||||||
newStamina = playerMaxStamina;
|
newStamina = playerMaxStamina;
|
||||||
}
|
}
|
||||||
session.getPlayer().setProperty(PlayerProperty.PROP_CUR_PERSIST_STAMINA, newStamina);
|
session.getPlayer().setProperty(PlayerProperty.PROP_CUR_PERSIST_STAMINA, newStamina);
|
||||||
|
session.send(new PacketPlayerPropNotify(player, PlayerProperty.PROP_CUR_PERSIST_STAMINA));
|
||||||
return newStamina;
|
return newStamina;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +308,6 @@ public class MovementManager {
|
|||||||
}
|
}
|
||||||
Grasscutter.getLogger().debug(getCurrentStamina() + "/" + getMaximumStamina() + "\t" + currentState + "\t" + "isMoving: " + isPlayerMoving() + "\t(" + consumption.consumptionType + "," + consumption.amount + ")");
|
Grasscutter.getLogger().debug(getCurrentStamina() + "/" + getMaximumStamina() + "\t" + currentState + "\t" + "isMoving: " + isPlayerMoving() + "\t(" + consumption.consumptionType + "," + consumption.amount + ")");
|
||||||
updateStamina(cachedSession, consumption.amount);
|
updateStamina(cachedSession, consumption.amount);
|
||||||
cachedSession.send(new PacketPlayerPropNotify(player, PlayerProperty.PROP_CUR_PERSIST_STAMINA));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// tick triggered
|
// tick triggered
|
||||||
|
Loading…
Reference in New Issue
Block a user