Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
5d917f18
Commit
5d917f18
authored
May 09, 2022
by
gentlespoon
Committed by
Melledy
May 09, 2022
Browse files
Move "if Grasscutter.getConfig().OpenStamina" to the correct place.
parent
eb2b2392
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/managers/StaminaManager/StaminaManager.java
View file @
5d917f18
...
@@ -190,6 +190,7 @@ public class StaminaManager {
...
@@ -190,6 +190,7 @@ 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
)
{
// set stamina
// set stamina
player
.
setProperty
(
PlayerProperty
.
PROP_CUR_PERSIST_STAMINA
,
newStamina
);
player
.
setProperty
(
PlayerProperty
.
PROP_CUR_PERSIST_STAMINA
,
newStamina
);
session
.
send
(
new
PacketPlayerPropNotify
(
player
,
PlayerProperty
.
PROP_CUR_PERSIST_STAMINA
));
session
.
send
(
new
PacketPlayerPropNotify
(
player
,
PlayerProperty
.
PROP_CUR_PERSIST_STAMINA
));
...
@@ -199,6 +200,8 @@ public class StaminaManager {
...
@@ -199,6 +200,8 @@ public class StaminaManager {
}
}
return
newStamina
;
return
newStamina
;
}
}
return
player
.
getProperty
(
PlayerProperty
.
PROP_CUR_PERSIST_STAMINA
);
}
// Kills avatar, removes entity and sends notification.
// Kills avatar, removes entity and sends notification.
// TODO: Probably move this to Avatar class? since other components may also need to kill avatar.
// TODO: Probably move this to Avatar class? since other components may also need to kill avatar.
...
@@ -288,7 +291,6 @@ public class StaminaManager {
...
@@ -288,7 +291,6 @@ public class StaminaManager {
private
class
SustainedStaminaHandler
extends
TimerTask
{
private
class
SustainedStaminaHandler
extends
TimerTask
{
public
void
run
()
{
public
void
run
()
{
if
(
Grasscutter
.
getConfig
().
OpenStamina
)
{
boolean
moving
=
isPlayerMoving
();
boolean
moving
=
isPlayerMoving
();
int
currentStamina
=
player
.
getProperty
(
PlayerProperty
.
PROP_CUR_PERSIST_STAMINA
);
int
currentStamina
=
player
.
getProperty
(
PlayerProperty
.
PROP_CUR_PERSIST_STAMINA
);
int
maxStamina
=
player
.
getProperty
(
PlayerProperty
.
PROP_MAX_STAMINA
);
int
maxStamina
=
player
.
getProperty
(
PlayerProperty
.
PROP_MAX_STAMINA
);
...
@@ -333,7 +335,6 @@ public class StaminaManager {
...
@@ -333,7 +335,6 @@ public class StaminaManager {
updateStaminaRelative
(
cachedSession
,
consumption
);
updateStaminaRelative
(
cachedSession
,
consumption
);
}
}
}
}
}
previousState
=
currentState
;
previousState
=
currentState
;
previousCoordinates
=
new
Position
(
previousCoordinates
=
new
Position
(
currentCoordinates
.
getX
(),
currentCoordinates
.
getX
(),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment