fix merge
This commit is contained in:
parent
efc565ae1b
commit
29bcc1e545
|
|
@ -37,7 +37,7 @@ object InviteCodeCommands {
|
||||||
tailrec suspend fun requireQQNumber(player: Player): String? {
|
tailrec suspend fun requireQQNumber(player: Player): String? {
|
||||||
val input = chatInput(player, "§e| §7请输入您的QQ号进行绑定 (输入 §ecancel §7取消)")
|
val input = chatInput(player, "§e| §7请输入您的QQ号进行绑定 (输入 §ecancel §7取消)")
|
||||||
if (input == "cancel") return null
|
if (input == "cancel") return null
|
||||||
if (input.length >= 10) return requireQQNumber(player)
|
if (input.length > 13) return requireQQNumber(player)
|
||||||
if (input.toLongOrNull() == null) return requireQQNumber(player)
|
if (input.toLongOrNull() == null) return requireQQNumber(player)
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
|
|
@ -196,7 +196,7 @@ object InviteCodeCommands {
|
||||||
output.createNewFile()
|
output.createNewFile()
|
||||||
output.writeText(result)
|
output.writeText(result)
|
||||||
}
|
}
|
||||||
sender.sendMessage("现存可用邀请码已保存至plugins/BiliInviteCode/current.txt")
|
sender.sendMessage("§a| §7现存可用邀请码已保存至plugins/BiliInviteCode/current.txt")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
package cc.maxmc.invite.listener
|
package cc.maxmc.invite.listener
|
||||||
|
|
||||||
import cc.maxmc.invite.PluginScope
|
import cc.maxmc.invite.PluginScope
|
||||||
|
import cc.maxmc.invite.concurrent.chatInput
|
||||||
import cc.maxmc.invite.data.InviteCode
|
import cc.maxmc.invite.data.InviteCode
|
||||||
import cc.maxmc.invite.data.InviteCodes
|
import cc.maxmc.invite.data.InviteCodes
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.bukkit.Location
|
import org.bukkit.Location
|
||||||
|
import org.bukkit.entity.Player
|
||||||
import org.bukkit.event.player.*
|
import org.bukkit.event.player.*
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
import org.jetbrains.exposed.sql.transactions.experimental.newSuspendedTransaction
|
||||||
import taboolib.common.platform.event.SubscribeEvent
|
import taboolib.common.platform.event.SubscribeEvent
|
||||||
import taboolib.common.platform.function.console
|
import taboolib.common.platform.function.console
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
@ -48,13 +50,24 @@ object InvitedListener {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
fun onJoin(e: PlayerJoinEvent) {
|
fun onJoin(e: PlayerJoinEvent) {
|
||||||
|
tailrec suspend fun requireQQNumber(player: Player): String? {
|
||||||
|
val input = chatInput(player, "§e| §7请输入您的QQ号进行绑定 (输入 §ecancel §7取消)")
|
||||||
|
if (input == "cancel") return null
|
||||||
|
if (input.length > 13) return requireQQNumber(player)
|
||||||
|
if (input.toLongOrNull() == null) return requireQQNumber(player)
|
||||||
|
return input
|
||||||
|
}
|
||||||
|
|
||||||
cache[e.player.uniqueId] = e.player.location
|
cache[e.player.uniqueId] = e.player.location
|
||||||
e.player.sendMessage("§e| §7正在检查您的邀请码...请稍等.")
|
e.player.sendMessage("§e| §7正在检查您的邀请码...请稍等.")
|
||||||
PluginScope.launch {
|
PluginScope.launch {
|
||||||
transaction {
|
newSuspendedTransaction {
|
||||||
val playerInviteCode = InviteCode.find { InviteCodes.uid eq e.player.uniqueId }
|
val playerInviteCode = InviteCode.find { InviteCodes.uid eq e.player.uniqueId }
|
||||||
.firstOrNull()
|
.firstOrNull()
|
||||||
?: return@transaction e.player.sendMessage("§c| §7您的账号未激活, 请输入 §c/ic use <激活码> §7来进行激活.")
|
?: return@newSuspendedTransaction e.player.sendMessage("§c| §7您的账号未激活, 请输入 §c/ic use <激活码> §7来进行激活.")
|
||||||
|
if (playerInviteCode.qq == null) {
|
||||||
|
playerInviteCode.qq = requireQQNumber(e.player)
|
||||||
|
}
|
||||||
e.player.sendMessage("§a| §7检查通过, 您可以正常进行游戏.")
|
e.player.sendMessage("§a| §7检查通过, 您可以正常进行游戏.")
|
||||||
cache.remove(e.player.uniqueId)
|
cache.remove(e.player.uniqueId)
|
||||||
val lastName = playerInviteCode.name
|
val lastName = playerInviteCode.name
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue