소스 검색

优化玩家下线相关功能模块处理

johnclot69 4 달 전
부모
커밋
428fc29cc9

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

@@ -57,7 +57,7 @@ public class Player extends GPlayer {
 
         this.refreshNewDay();
 
-        for (ModuleManager manager : allManagers.values()) {
+        for (ModuleManager manager : this.allManagers.values()) {
             try {
                 manager.onPlayerEvent(PlayerEventType.AFTER_LOGIN);
             } catch (Exception e) {
@@ -99,7 +99,11 @@ public class Player extends GPlayer {
 
     @Override
     public void onLogoutUpdate() {
-        this.logger.info("退出更新, 退出清理...");
+        this.logger.info("处理玩家下线逻辑 : {}, {}", this.getId(), this.data.name);
+        // 下线相关模块处理
+        for (ModuleManager manager : this.allManagers.values()) {
+            manager.onPlayerEvent(PlayerEventType.OFFLINE);
+        }
     }
 
     @Override

+ 0 - 1
incubator-game/src/main/java/com/incubator/game/timer/RefreshNewDay.java

@@ -30,7 +30,6 @@ public final class RefreshNewDay extends QuartzTask {
 
     @Override
     public void execute(JobExecutionContext context) throws JobExecutionException {
-        //0.先统计数据
         //1.刷新玩家数据
         Player player = null;
         for (GPlayer gPlayer : GGame.onlinePlayers.values()) {