mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-30 15:08:43 +00:00
Stamina will be set to full if Stamina is disabled.
This commit is contained in:
parent
fd3e59f332
commit
8074f47c6a
@ -190,17 +190,17 @@ public class StaminaManager {
|
|||||||
|
|
||||||
// Returns new stamina and sends PlayerPropNotify
|
// Returns new stamina and sends PlayerPropNotify
|
||||||
public int setStamina(GameSession session, String reason, int newStamina) {
|
public int setStamina(GameSession session, String reason, int newStamina) {
|
||||||
if (Grasscutter.getConfig().OpenStamina) {
|
if (!Grasscutter.getConfig().OpenStamina) {
|
||||||
// set stamina
|
newStamina = player.getProperty(PlayerProperty.PROP_MAX_STAMINA);
|
||||||
player.setProperty(PlayerProperty.PROP_CUR_PERSIST_STAMINA, newStamina);
|
|
||||||
session.send(new PacketPlayerPropNotify(player, PlayerProperty.PROP_CUR_PERSIST_STAMINA));
|
|
||||||
// notify updated
|
|
||||||
for (Map.Entry<String, AfterUpdateStaminaListener> listener : afterUpdateStaminaListeners.entrySet()) {
|
|
||||||
listener.getValue().onAfterUpdateStamina(reason, newStamina);
|
|
||||||
}
|
|
||||||
return newStamina;
|
|
||||||
}
|
}
|
||||||
return player.getProperty(PlayerProperty.PROP_CUR_PERSIST_STAMINA);
|
// set stamina
|
||||||
|
player.setProperty(PlayerProperty.PROP_CUR_PERSIST_STAMINA, newStamina);
|
||||||
|
session.send(new PacketPlayerPropNotify(player, PlayerProperty.PROP_CUR_PERSIST_STAMINA));
|
||||||
|
// notify updated
|
||||||
|
for (Map.Entry<String, AfterUpdateStaminaListener> listener : afterUpdateStaminaListeners.entrySet()) {
|
||||||
|
listener.getValue().onAfterUpdateStamina(reason, newStamina);
|
||||||
|
}
|
||||||
|
return newStamina;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kills avatar, removes entity and sends notification.
|
// Kills avatar, removes entity and sends notification.
|
||||||
|
Loading…
Reference in New Issue
Block a user