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
a65823d2
Commit
a65823d2
authored
3 years ago
by
Magix
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #580 from Bwly999/development
Fix the problem that the reference of serverHook in Plugin object is null
parents
38fd7bb7
711ae2f5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/emu/grasscutter/Grasscutter.java
+2
-3
2 additions, 3 deletions
src/main/java/emu/grasscutter/Grasscutter.java
src/main/java/emu/grasscutter/server/game/GameServer.java
+21
-13
21 additions, 13 deletions
src/main/java/emu/grasscutter/server/game/GameServer.java
with
23 additions
and
16 deletions
src/main/java/emu/grasscutter/Grasscutter.java
+
2
−
3
View file @
a65823d2
...
@@ -96,14 +96,13 @@ public final class Grasscutter {
...
@@ -96,14 +96,13 @@ public final class Grasscutter {
// Database
// Database
DatabaseManager
.
initialize
();
DatabaseManager
.
initialize
();
// Create plugin manager instance.
pluginManager
=
new
PluginManager
();
// Create server instances.
// Create server instances.
dispatchServer
=
new
DispatchServer
();
dispatchServer
=
new
DispatchServer
();
gameServer
=
new
GameServer
();
gameServer
=
new
GameServer
();
// Create a server hook instance with both servers.
// Create a server hook instance with both servers.
new
ServerHook
(
gameServer
,
dispatchServer
);
new
ServerHook
(
gameServer
,
dispatchServer
);
// Create plugin manager instance.
pluginManager
=
new
PluginManager
();
// Start servers.
// Start servers.
if
(
getConfig
().
RunMode
==
ServerRunMode
.
HYBRID
)
{
if
(
getConfig
().
RunMode
==
ServerRunMode
.
HYBRID
)
{
...
...
This diff is collapsed.
Click to expand it.
src/main/java/emu/grasscutter/server/game/GameServer.java
+
21
−
13
View file @
a65823d2
...
@@ -29,6 +29,9 @@ import java.net.InetSocketAddress;
...
@@ -29,6 +29,9 @@ import java.net.InetSocketAddress;
import
java.time.OffsetDateTime
;
import
java.time.OffsetDateTime
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.ScheduledExecutorService
;
import
java.util.concurrent.TimeUnit
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
...
@@ -80,19 +83,6 @@ public final class GameServer extends KcpServer {
...
@@ -80,19 +83,6 @@ public final class GameServer extends KcpServer {
this
.
expeditionManager
=
new
ExpeditionManager
(
this
);
this
.
expeditionManager
=
new
ExpeditionManager
(
this
);
this
.
combineManger
=
new
CombineManger
(
this
);
this
.
combineManger
=
new
CombineManger
(
this
);
// Schedule game loop.
Timer
gameLoop
=
new
Timer
();
gameLoop
.
scheduleAtFixedRate
(
new
TimerTask
()
{
@Override
public
void
run
()
{
try
{
onTick
();
}
catch
(
Exception
e
)
{
Grasscutter
.
getLogger
().
error
(
translate
(
"messages.game.game_update_error"
),
e
);
}
}
},
new
Date
(),
1000L
);
// Hook into shutdown event.
// Hook into shutdown event.
Runtime
.
getRuntime
().
addShutdownHook
(
new
Thread
(
this
::
onServerShutdown
));
Runtime
.
getRuntime
().
addShutdownHook
(
new
Thread
(
this
::
onServerShutdown
));
}
}
...
@@ -229,6 +219,24 @@ public final class GameServer extends KcpServer {
...
@@ -229,6 +219,24 @@ public final class GameServer extends KcpServer {
}
}
@Override
public
synchronized
void
start
()
{
// Schedule game loop.
Timer
gameLoop
=
new
Timer
();
gameLoop
.
scheduleAtFixedRate
(
new
TimerTask
()
{
@Override
public
void
run
()
{
try
{
onTick
();
}
catch
(
Exception
e
)
{
Grasscutter
.
getLogger
().
error
(
translate
(
"messages.game.game_update_error"
),
e
);
}
}
},
new
Date
(),
1000L
);
super
.
start
();
}
@Override
@Override
public
void
onStartFinish
()
{
public
void
onStartFinish
()
{
Grasscutter
.
getLogger
().
info
(
translate
(
"messages.status.free_software"
));
Grasscutter
.
getLogger
().
info
(
translate
(
"messages.status.free_software"
));
...
...
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