Commit 0ea0eab6 authored by gentlespoon's avatar gentlespoon Committed by Melledy
Browse files

Stamina will be set to full if Stamina is disabled.

parent c424d15b
...@@ -190,17 +190,17 @@ public class StaminaManager { ...@@ -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)); // set stamina
// notify updated player.setProperty(PlayerProperty.PROP_CUR_PERSIST_STAMINA, newStamina);
for (Map.Entry<String, AfterUpdateStaminaListener> listener : afterUpdateStaminaListeners.entrySet()) { session.send(new PacketPlayerPropNotify(player, PlayerProperty.PROP_CUR_PERSIST_STAMINA));
listener.getValue().onAfterUpdateStamina(reason, newStamina); // notify updated
} for (Map.Entry<String, AfterUpdateStaminaListener> listener : afterUpdateStaminaListeners.entrySet()) {
return newStamina; listener.getValue().onAfterUpdateStamina(reason, newStamina);
} }
return player.getProperty(PlayerProperty.PROP_CUR_PERSIST_STAMINA); return newStamina;
} }
// Kills avatar, removes entity and sends notification. // Kills avatar, removes entity and sends notification.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment