Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Grasscutter
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
ziqian zhang
Grasscutter
Commits
a09723f0
Commit
a09723f0
authored
3 years ago
by
gentlespoon
Committed by
Melledy
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix: timer is already cancelled.
parent
7c35c51a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/emu/grasscutter/game/managers/StaminaManager/StaminaManager.java
+7
-9
7 additions, 9 deletions
...sscutter/game/managers/StaminaManager/StaminaManager.java
with
7 additions
and
9 deletions
src/main/java/emu/grasscutter/game/managers/StaminaManager/StaminaManager.java
+
7
−
9
View file @
a09723f0
...
@@ -29,9 +29,7 @@ public class StaminaManager {
...
@@ -29,9 +29,7 @@ public class StaminaManager {
private
Position
previousCoordinates
=
new
Position
(
0
,
0
,
0
);
private
Position
previousCoordinates
=
new
Position
(
0
,
0
,
0
);
private
MotionState
currentState
=
MotionState
.
MOTION_STANDBY
;
private
MotionState
currentState
=
MotionState
.
MOTION_STANDBY
;
private
MotionState
previousState
=
MotionState
.
MOTION_STANDBY
;
private
MotionState
previousState
=
MotionState
.
MOTION_STANDBY
;
private
final
Timer
sustainedStaminaHandlerTimer
=
new
Timer
();
private
Timer
sustainedStaminaHandlerTimer
;
private
final
SustainedStaminaHandler
handleSustainedStamina
=
new
SustainedStaminaHandler
();
private
boolean
timerRunning
=
false
;
private
GameSession
cachedSession
=
null
;
private
GameSession
cachedSession
=
null
;
private
GameEntity
cachedEntity
=
null
;
private
GameEntity
cachedEntity
=
null
;
private
int
staminaRecoverDelay
=
0
;
private
int
staminaRecoverDelay
=
0
;
...
@@ -140,17 +138,17 @@ public class StaminaManager {
...
@@ -140,17 +138,17 @@ public class StaminaManager {
}
}
public
void
startSustainedStaminaHandler
()
{
public
void
startSustainedStaminaHandler
()
{
if
(!
player
.
isPaused
()
&&
!
timerRunning
)
{
if
(!
player
.
isPaused
()
&&
sustainedStaminaHandlerTimer
==
null
)
{
timerRunning
=
true
;
sustainedStaminaHandlerTimer
=
new
Timer
()
;
sustainedStaminaHandlerTimer
.
scheduleAtFixedRate
(
handle
SustainedStamina
,
0
,
200
);
sustainedStaminaHandlerTimer
.
scheduleAtFixedRate
(
new
SustainedStamina
Handler
()
,
0
,
200
);
// Grasscutter.getLogger().debug("[MovementManager] SustainedStaminaHandlerTimer started");
// Grasscutter.getLogger().debug("[MovementManager] SustainedStaminaHandlerTimer started");
}
}
}
}
public
void
stopSustainedStaminaHandler
()
{
public
void
stopSustainedStaminaHandler
()
{
if
(
timerRunning
)
{
if
(
sustainedStaminaHandlerTimer
!=
null
)
{
timerRunning
=
false
;
sustainedStaminaHandlerTimer
.
cancel
();
sustainedStaminaHandlerTimer
.
cancel
();
sustainedStaminaHandlerTimer
=
null
;
// Grasscutter.getLogger().debug("[MovementManager] SustainedStaminaHandlerTimer stopped");
// Grasscutter.getLogger().debug("[MovementManager] SustainedStaminaHandlerTimer stopped");
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment