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
e8601de5
Commit
e8601de5
authored
Apr 20, 2022
by
Benjamin Elsdon
Browse files
Added OnGameServerStartFinish EventBus
Removed those temporary warning messages as I figured out how to disable them
parent
b7f5cc97
Changes
2
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/game/GameServer.java
View file @
e8601de5
...
...
@@ -3,7 +3,6 @@ package emu.grasscutter.server.game;
import
java.net.InetSocketAddress
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.CountDownLatch
;
import
emu.grasscutter.GenshinConstants
;
import
emu.grasscutter.Grasscutter
;
...
...
@@ -20,7 +19,6 @@ import emu.grasscutter.game.shop.ShopManager;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.proto.SocialDetailOuterClass.SocialDetail
;
import
emu.grasscutter.netty.MihoyoKcpServer
;
import
jdk.internal.event.Event
;
import
org.greenrobot.eventbus.EventBus
;
public
final
class
GameServer
extends
MihoyoKcpServer
{
...
...
@@ -37,14 +35,16 @@ public final class GameServer extends MihoyoKcpServer {
private
final
DungeonManager
dungeonManager
;
private
final
CommandMap
commandMap
;
public
EventBus
OnGameServerStartFinish
;
public
EventBus
OnGameServerTick
;
public
EventBus
OnGameServerStop
;
public
GameServer
(
InetSocketAddress
address
)
{
super
(
address
);
OnGameServerTick
=
EventBus
.
builder
().
throwSubscriberException
(
true
).
build
();
OnGameServerStop
=
EventBus
.
builder
().
throwSubscriberException
(
true
).
build
();
OnGameServerStartFinish
=
EventBus
.
builder
().
throwSubscriberException
(
true
).
logNoSubscriberMessages
(
false
).
build
();
OnGameServerTick
=
EventBus
.
builder
().
throwSubscriberException
(
true
).
logNoSubscriberMessages
(
false
).
build
();
OnGameServerStop
=
EventBus
.
builder
().
throwSubscriberException
(
true
).
logNoSubscriberMessages
(
false
).
build
();
this
.
setServerInitializer
(
new
GameServerInitializer
(
this
));
this
.
address
=
address
;
...
...
@@ -171,13 +171,12 @@ public final class GameServer extends MihoyoKcpServer {
@Override
public
void
onStartFinish
()
{
Grasscutter
.
getLogger
().
info
(
"Game Server started on port "
+
address
.
getPort
());
OnGameServerStartFinish
.
post
(
new
GameServerStartFinishEvent
());
}
public
void
onServerShutdown
()
{
OnGameServerStop
.
post
(
new
GameServerStopEvent
());
Grasscutter
.
getLogger
().
info
(
"Ignore the 'No subscribers registered' error"
);
// TODO: Remove the log once things actually listen to OnGameServerStop.
// I just added it there to prevent people from flooding #support with this error
// Kick and save all players
List
<
GenshinPlayer
>
list
=
new
ArrayList
<>(
this
.
getPlayers
().
size
());
...
...
src/main/java/emu/grasscutter/server/game/GameServerStartFinishEvent.java
0 → 100644
View file @
e8601de5
package
emu.grasscutter.server.game
;
public
class
GameServerStartFinishEvent
{
// Placeholder class for now, probably will get used later
}
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