diff --git a/src/main/java/emu/grasscutter/server/game/GameServer.java b/src/main/java/emu/grasscutter/server/game/GameServer.java index a54d3900d..663d99728 100644 --- a/src/main/java/emu/grasscutter/server/game/GameServer.java +++ b/src/main/java/emu/grasscutter/server/game/GameServer.java @@ -58,13 +58,21 @@ public final class GameServer extends KcpServer { private final CombineManger combineManger; private final TowerScheduleManager towerScheduleManager; - public GameServer() { - this(new InetSocketAddress( - GAME_INFO.bindAddress, - GAME_INFO.bindPort - )); + private static InetSocketAddress getAdapterInetSocketAddress(){ + InetSocketAddress inetSocketAddress = null; + if(GAME_INFO.bindAddress.equals("")){ + inetSocketAddress=new InetSocketAddress(GAME_INFO.bindPort); + }else{ + inetSocketAddress=new InetSocketAddress( + GAME_INFO.bindAddress, + GAME_INFO.bindPort + ); + } + return inetSocketAddress; + } + public GameServer() { + this(getAdapterInetSocketAddress()); } - public GameServer(InetSocketAddress address) { super(address); diff --git a/src/main/java/emu/grasscutter/server/http/HttpServer.java b/src/main/java/emu/grasscutter/server/http/HttpServer.java index dc005e249..bcc020ed7 100644 --- a/src/main/java/emu/grasscutter/server/http/HttpServer.java +++ b/src/main/java/emu/grasscutter/server/http/HttpServer.java @@ -129,7 +129,11 @@ public final class HttpServer { */ public void start() { // Attempt to start the HTTP server. - this.express.listen(HTTP_INFO.bindAddress, HTTP_INFO.bindPort); + if(HTTP_INFO.bindAddress.equals("")){ + this.express.listen(HTTP_INFO.bindPort); + }else{ + this.express.listen(HTTP_INFO.bindAddress, HTTP_INFO.bindPort); + } // Log bind information. Grasscutter.getLogger().info(translate("messages.dispatch.port_bind", Integer.toString(this.express.raw().port())));