Browse Source

优化不必要的导入

johnclot69 4 months ago
parent
commit
77e5512ecc

+ 1 - 11
incubator-game/src/main/java/com/incubator/game/GGame.java

@@ -4,7 +4,6 @@ import com.incubator.common.MessageHandler;
 import com.incubator.common.env.Environment;
 import com.incubator.common.game.AbstractService;
 import com.incubator.common.log4j.Log4jUtil;
-import com.incubator.common.net.Connection;
 import com.incubator.common.net.NetClient;
 import com.incubator.common.net.NetServer;
 import com.incubator.common.net.netty.client.NettyClient;
@@ -30,14 +29,9 @@ import com.incubator.game.timer.FlushDB;
 import com.incubator.game.timer.RefreshNewDay;
 import com.incubator.game.util.GameDataUtil;
 import org.apache.commons.lang3.StringUtils;
-import org.dom4j.Document;
-import org.dom4j.Element;
-import org.dom4j.io.SAXReader;
 import org.reflections.Reflections;
 import org.slf4j.Logger;
 
-import java.io.File;
-import java.io.FileInputStream;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
@@ -124,10 +118,6 @@ public class GGame extends AbstractService {
         return instance;
     }
 
-    public static void addPlayer(GPlayer player) {
-        onlinePlayers.put(player.getId(), player);
-    }
-
     public static LSDBHandler getDBHandler() {
         return lsDBHandler;
     }
@@ -422,7 +412,7 @@ public class GGame extends AbstractService {
                             new InitalizerProtocolHandler(new CenterClientListener())
                     )
             );
-            centerClient.enableReconnect(scheduleExec, TimeUnit.SECONDS.toMillis(5));
+            centerClient.enableReconnect(GGame.scheduleExec, TimeUnit.SECONDS.toMillis(5));
             centerClient.setName("CenterClient");
             centerClient.start();
             logger.info("中控服务连接成功,地址: {}:{}", CENTER_HOST, CENTER_PORT);

+ 1 - 1
incubator-game/src/main/java/com/incubator/game/player/Player.java

@@ -34,7 +34,7 @@ public class Player extends GPlayer {
         this.refreshNewDay();
 
         // 加入在线玩家集合
-        GGame.addPlayer(this);
+        GGame.onlinePlayers.put(this.getId(), this);
     }
 
     /**