From b977b616a1794c69c719f24df8449a192f045abb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=B8=94=E6=B0=91=E5=B0=8F=E9=95=87?= <262610965@qq.com>
Date: Mon, 9 Sep 2024 12:58:31 +0800
Subject: [PATCH] :whale: 21.16
---
README.md | 2 +-
common/common-core/pom.xml | 2 +-
.../game/action/skeleton/IoGameVersion.java | 2 +-
common/common-kit/pom.xml | 2 +-
common/common-micro-kit/pom.xml | 2 +-
.../concurrent/timer/delay/DelayTaskTest.java | 41 +++++++++++++++++++
common/common-validation/pom.xml | 2 +-
external/external-core/pom.xml | 2 +-
.../external/core/session/UserSessions.java | 3 +-
external/external-netty/pom.xml | 2 +-
net-bolt/bolt-broker-server/pom.xml | 2 +-
net-bolt/bolt-client/pom.xml | 2 +-
net-bolt/bolt-core/pom.xml | 2 +-
pom.xml | 4 +-
run-one/run-one-netty/pom.xml | 2 +-
widget/light-client/pom.xml | 2 +-
widget/light-domain-event/pom.xml | 2 +-
widget/light-game-room/pom.xml | 2 +-
widget/light-jprotobuf/pom.xml | 2 +-
widget/light-profile/pom.xml | 2 +-
widget/other-tool/pom.xml | 2 +-
21 files changed, 62 insertions(+), 22 deletions(-)
diff --git a/README.md b/README.md
index 93ec5b87c..ee3a00520 100644
--- a/README.md
+++ b/README.md
@@ -218,7 +218,7 @@ ioGame 是轻量级的网络编程框架,**不依赖任何第三方**中间件
com.iohao.game
run-one-netty
- 21.15
+ 21.16
```
diff --git a/common/common-core/pom.xml b/common/common-core/pom.xml
index 8a333add5..42c37d737 100644
--- a/common/common-core/pom.xml
+++ b/common/common-core/pom.xml
@@ -5,7 +5,7 @@
ioGame
com.iohao.game
- 21.15
+ 21.16
../../pom.xml
4.0.0
diff --git a/common/common-core/src/main/java/com/iohao/game/action/skeleton/IoGameVersion.java b/common/common-core/src/main/java/com/iohao/game/action/skeleton/IoGameVersion.java
index 45d3919d5..19d30ccdc 100644
--- a/common/common-core/src/main/java/com/iohao/game/action/skeleton/IoGameVersion.java
+++ b/common/common-core/src/main/java/com/iohao/game/action/skeleton/IoGameVersion.java
@@ -26,7 +26,7 @@ public final class IoGameVersion {
public static final String VERSION;
static {
- String internalVersion = "21.15";
+ String internalVersion = "21.16";
VERSION = internalVersion
.replace("", "")
diff --git a/common/common-kit/pom.xml b/common/common-kit/pom.xml
index e83af7dcf..a04890776 100644
--- a/common/common-kit/pom.xml
+++ b/common/common-kit/pom.xml
@@ -5,7 +5,7 @@
ioGame
com.iohao.game
- 21.15
+ 21.16
../../pom.xml
4.0.0
diff --git a/common/common-micro-kit/pom.xml b/common/common-micro-kit/pom.xml
index a6890b5e7..d0298d2b2 100644
--- a/common/common-micro-kit/pom.xml
+++ b/common/common-micro-kit/pom.xml
@@ -6,7 +6,7 @@
com.iohao.game
ioGame
- 21.15
+ 21.16
../../pom.xml
diff --git a/common/common-micro-kit/src/test/java/com/iohao/game/common/kit/concurrent/timer/delay/DelayTaskTest.java b/common/common-micro-kit/src/test/java/com/iohao/game/common/kit/concurrent/timer/delay/DelayTaskTest.java
index 416f54d1b..f6d798c4b 100644
--- a/common/common-micro-kit/src/test/java/com/iohao/game/common/kit/concurrent/timer/delay/DelayTaskTest.java
+++ b/common/common-micro-kit/src/test/java/com/iohao/game/common/kit/concurrent/timer/delay/DelayTaskTest.java
@@ -270,4 +270,45 @@ public void onUpdate() {
log.info("向【{}】开炮,造成 {} 伤害", targetEntity, value);
}
}
+
+ @Test
+ public void example() {
+ long timeMillis = System.currentTimeMillis();
+
+ DelayTask delayTask = DelayTaskKit.of(() -> {
+ long value = System.currentTimeMillis() - timeMillis;
+ log.info("1 - 最终 {} ms 后,执行延时任务", value);
+ })
+ .plusTime(Duration.ofSeconds(1)) // 增加 1 秒的延时
+ // 启动任务
+ .task();
+
+ delayTask.plusTimeMillis(500); // 增加 0.5 秒的延时
+ delayTask.minusTimeMillis(500);// 减少 0.5 秒的延时时间
+
+ // 因为 taskId 相同,所以会覆盖之前的延时任务
+ String taskId = delayTask.getTaskId();
+ delayTask = DelayTaskKit.of(taskId, () -> {
+ long value = System.currentTimeMillis() - timeMillis;
+ log.info("2 - 最终 {} ms 后,执行延时任务", value);
+ })
+ .plusTime(Duration.ofSeconds(1)) // 增加 1 秒的延时
+ // 启动任务
+ .task();
+
+ // 取消延时任务,下面两个方法是等价的
+ delayTask.cancel();
+ DelayTaskKit.cancel(taskId);
+
+ // 可以通过 taskId 查找该延时任务
+ Optional optionalDelayTask = DelayTaskKit.optional(taskId);
+ if (optionalDelayTask.isPresent()) {
+ var delayTaskObj = optionalDelayTask.get();
+ }
+
+ // 通过 taskId 查找延时任务,存在则执行给定逻辑
+ DelayTaskKit.ifPresent(taskId, task -> {
+ task.plusTimeMillis(500); // 增加 0.5 秒的延时时间
+ });
+ }
}
\ No newline at end of file
diff --git a/common/common-validation/pom.xml b/common/common-validation/pom.xml
index 59b4e9e80..d5c9c6b4a 100644
--- a/common/common-validation/pom.xml
+++ b/common/common-validation/pom.xml
@@ -5,7 +5,7 @@
ioGame
com.iohao.game
- 21.15
+ 21.16
../../pom.xml
4.0.0
diff --git a/external/external-core/pom.xml b/external/external-core/pom.xml
index c68a095e3..8f6f6f3a3 100644
--- a/external/external-core/pom.xml
+++ b/external/external-core/pom.xml
@@ -6,7 +6,7 @@
com.iohao.game
ioGame
- 21.15
+ 21.16
../../pom.xml
diff --git a/external/external-core/src/main/java/com/iohao/game/external/core/session/UserSessions.java b/external/external-core/src/main/java/com/iohao/game/external/core/session/UserSessions.java
index d85b519f4..f7bfbbc93 100644
--- a/external/external-core/src/main/java/com/iohao/game/external/core/session/UserSessions.java
+++ b/external/external-core/src/main/java/com/iohao/game/external/core/session/UserSessions.java
@@ -18,7 +18,6 @@
*/
package com.iohao.game.external.core.session;
-import com.iohao.game.common.kit.CollKit;
import com.iohao.game.common.kit.attr.AttrOptionDynamic;
import com.iohao.game.external.core.hook.UserHook;
@@ -101,7 +100,7 @@ default void ifPresent(Collection userIdList, Consumer consumer)
boolean existUserSession(long userId);
/**
- * 设置 channel 的 userId
+ * 设置 channel 的 userId,表示已经身份验证了(即登录过了)。
*
* @param userChannelId userChannelId
* @param userId userId
diff --git a/external/external-netty/pom.xml b/external/external-netty/pom.xml
index 2547fdc8e..6fad468cd 100644
--- a/external/external-netty/pom.xml
+++ b/external/external-netty/pom.xml
@@ -6,7 +6,7 @@
com.iohao.game
ioGame
- 21.15
+ 21.16
../../pom.xml
diff --git a/net-bolt/bolt-broker-server/pom.xml b/net-bolt/bolt-broker-server/pom.xml
index 64d4201f0..f79666622 100644
--- a/net-bolt/bolt-broker-server/pom.xml
+++ b/net-bolt/bolt-broker-server/pom.xml
@@ -5,7 +5,7 @@
ioGame
com.iohao.game
- 21.15
+ 21.16
../../pom.xml
4.0.0
diff --git a/net-bolt/bolt-client/pom.xml b/net-bolt/bolt-client/pom.xml
index 9c55b945d..ad49836bb 100644
--- a/net-bolt/bolt-client/pom.xml
+++ b/net-bolt/bolt-client/pom.xml
@@ -5,7 +5,7 @@
ioGame
com.iohao.game
- 21.15
+ 21.16
../../pom.xml
4.0.0
diff --git a/net-bolt/bolt-core/pom.xml b/net-bolt/bolt-core/pom.xml
index f5076be9e..36894585e 100644
--- a/net-bolt/bolt-core/pom.xml
+++ b/net-bolt/bolt-core/pom.xml
@@ -5,7 +5,7 @@
ioGame
com.iohao.game
- 21.15
+ 21.16
../../pom.xml
4.0.0
diff --git a/pom.xml b/pom.xml
index 3dec8d562..8cab0bc99 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.iohao.game
ioGame
- 21.15
+ 21.16
ioGame
生产资料公有制。
@@ -53,7 +53,7 @@
UTF-8
- 4.1.112.Final
+ 4.1.113.Final
1.6.6
diff --git a/run-one/run-one-netty/pom.xml b/run-one/run-one-netty/pom.xml
index a7436c262..5f461222e 100644
--- a/run-one/run-one-netty/pom.xml
+++ b/run-one/run-one-netty/pom.xml
@@ -6,7 +6,7 @@
com.iohao.game
ioGame
- 21.15
+ 21.16
../../pom.xml
diff --git a/widget/light-client/pom.xml b/widget/light-client/pom.xml
index 6f96dc7d8..84fa993db 100644
--- a/widget/light-client/pom.xml
+++ b/widget/light-client/pom.xml
@@ -6,7 +6,7 @@
com.iohao.game
ioGame
- 21.15
+ 21.16
../../pom.xml
diff --git a/widget/light-domain-event/pom.xml b/widget/light-domain-event/pom.xml
index b8d0319cb..96481db0e 100644
--- a/widget/light-domain-event/pom.xml
+++ b/widget/light-domain-event/pom.xml
@@ -5,7 +5,7 @@
ioGame
com.iohao.game
- 21.15
+ 21.16
../../pom.xml
4.0.0
diff --git a/widget/light-game-room/pom.xml b/widget/light-game-room/pom.xml
index 8dae34160..eab444edb 100644
--- a/widget/light-game-room/pom.xml
+++ b/widget/light-game-room/pom.xml
@@ -5,7 +5,7 @@
ioGame
com.iohao.game
- 21.15
+ 21.16
../../pom.xml
4.0.0
diff --git a/widget/light-jprotobuf/pom.xml b/widget/light-jprotobuf/pom.xml
index 019e7ce26..07c97378f 100644
--- a/widget/light-jprotobuf/pom.xml
+++ b/widget/light-jprotobuf/pom.xml
@@ -5,7 +5,7 @@
ioGame
com.iohao.game
- 21.15
+ 21.16
../../pom.xml
4.0.0
diff --git a/widget/light-profile/pom.xml b/widget/light-profile/pom.xml
index ce97be7d2..86737048d 100644
--- a/widget/light-profile/pom.xml
+++ b/widget/light-profile/pom.xml
@@ -5,7 +5,7 @@
ioGame
com.iohao.game
- 21.15
+ 21.16
../../pom.xml
4.0.0
diff --git a/widget/other-tool/pom.xml b/widget/other-tool/pom.xml
index a2a6fb4a9..f1ab27c60 100644
--- a/widget/other-tool/pom.xml
+++ b/widget/other-tool/pom.xml
@@ -6,7 +6,7 @@
com.iohao.game
ioGame
- 21.15
+ 21.16
../../pom.xml