Skip to content

Commit aeaa4e2

Browse files
committed
Add feature about whitelist
1 parent 529b241 commit aeaa4e2

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group=top.alazeprt.aqqbot
2-
version=1.0.6
2+
version=1.0.7
33
kotlin.incremental=true
44
kotlin.incremental.java=true
55
kotlin.caching.enabled=true

src/main/kotlin/top/alazeprt/aqqbot/event/AJoinEvent.kt

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import taboolib.common.platform.function.info
1010
import taboolib.common.platform.function.submit
1111
import top.alazeprt.aonebot.action.SendGroupMessage
1212
import top.alazeprt.aqqbot.AQQBot
13+
import top.alazeprt.aqqbot.AQQBot.config
1314
import top.alazeprt.aqqbot.AQQBot.isFileStorage
1415
import top.alazeprt.aqqbot.util.AI18n.get
1516
import top.alazeprt.aqqbot.util.DBQuery.playerInDatabase
@@ -19,6 +20,7 @@ object AJoinEvent {
1920
@Ghost
2021
@SubscribeEvent
2122
fun onJoin(event: AsyncPlayerPreLoginEvent) {
23+
if (!config.getBoolean("enable") || !config.getBoolean("whitelist.need_bind_to_login")) return
2224
if (isFileStorage && event.name !in AQQBot.dataMap.values) {
2325
event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, formatString(get("game.not_bind", mutableMapOf(Pair("command", AQQBot.config.getStringList("whitelist.prefix.bind")[0])))))
2426
}
@@ -43,6 +45,7 @@ object AJoinEvent {
4345
@Ghost
4446
@SubscribeEvent
4547
fun onVCJoin(event: PostLoginEvent) {
48+
if (!config.getBoolean("enable") || !config.getBoolean("whitelist.need_bind_to_login")) return
4649
if (isFileStorage && event.player.username !in AQQBot.dataMap.values) {
4750
event.player.disconnect(Component.text(formatString(get("game.not_bind", mutableMapOf(Pair("command", AQQBot.config.getStringList("whitelist.prefix.bind")[0]))))))
4851
}

src/main/resources/config.yml

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ whitelist:
2424
# 是否启用该功能
2525
enable: true
2626

27+
# 是否必须绑定后才能进入游戏
28+
need_bind_to_login: true
29+
2730
# 功能指令前缀
2831
prefix:
2932
# 绑定指令前缀

0 commit comments

Comments
 (0)