bug fix
This commit is contained in:
parent
42b584a123
commit
822b0a8208
|
|
@ -168,12 +168,16 @@ object InviteCodeCommands {
|
||||||
|
|
||||||
private fun CommandBuilder.CommandComponent.cmdRemove() = literal("remove") {
|
private fun CommandBuilder.CommandComponent.cmdRemove() = literal("remove") {
|
||||||
execute<ConsoleCommandSender> { sender, _, arg ->
|
execute<ConsoleCommandSender> { sender, _, arg ->
|
||||||
val findings = InviteCode.find { InviteCodes.inviteCode eq arg }
|
PluginScope.launch {
|
||||||
if (findings.empty()) {
|
transaction {
|
||||||
sender.sendMessage("§e| §7该邀请码不存在, 无需删除.")
|
val findings = InviteCode.find { InviteCodes.inviteCode eq arg }
|
||||||
|
if (findings.empty()) {
|
||||||
|
sender.sendMessage("§e| §7该邀请码不存在, 无需删除.")
|
||||||
|
}
|
||||||
|
findings.first().delete()
|
||||||
|
sender.sendMessage("§a| §7成功删除该邀请码.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
findings.first().delete()
|
|
||||||
sender.sendMessage("§a| §7成功删除该邀请码.")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -181,8 +185,10 @@ object InviteCodeCommands {
|
||||||
execute<ConsoleCommandSender> { sender, _, _ ->
|
execute<ConsoleCommandSender> { sender, _, _ ->
|
||||||
PluginScope.launch {
|
PluginScope.launch {
|
||||||
val codes = ArrayList<String>(2000)
|
val codes = ArrayList<String>(2000)
|
||||||
InviteCode.find { InviteCodes.uid eq null }.forEach {
|
transaction {
|
||||||
codes.add(it.inviteCode)
|
InviteCode.find { InviteCodes.uid eq null }.forEach {
|
||||||
|
codes.add(it.inviteCode)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
val result = codes.joinToString("\n")
|
val result = codes.joinToString("\n")
|
||||||
val output = File(getDataFolder(), "current.txt")
|
val output = File(getDataFolder(), "current.txt")
|
||||||
|
|
|
||||||
|
|
@ -1,41 +1,41 @@
|
||||||
package cc.maxmc.invite.command
|
//package cc.maxmc.invite.command
|
||||||
|
//
|
||||||
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 org.jetbrains.exposed.sql.SchemaUtils
|
//import org.jetbrains.exposed.sql.SchemaUtils
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
//import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
|
//
|
||||||
object DebugCommands {
|
//object DebugCommands {
|
||||||
fun debug() {
|
// fun debug() {
|
||||||
taboolib.common.platform.function.console().sendMessage("§c|")
|
// taboolib.common.platform.function.console().sendMessage("§c|")
|
||||||
taboolib.common.platform.function.console().sendMessage("§c|")
|
// taboolib.common.platform.function.console().sendMessage("§c|")
|
||||||
taboolib.common.platform.function.console().sendMessage("§c|")
|
// taboolib.common.platform.function.console().sendMessage("§c|")
|
||||||
taboolib.common.platform.function.console().sendMessage("§c| DEBUG 模式已开启!")
|
// taboolib.common.platform.function.console().sendMessage("§c| DEBUG 模式已开启!")
|
||||||
taboolib.common.platform.function.console().sendMessage("§c|")
|
// taboolib.common.platform.function.console().sendMessage("§c|")
|
||||||
taboolib.common.platform.function.console().sendMessage("§c|")
|
// taboolib.common.platform.function.console().sendMessage("§c|")
|
||||||
taboolib.common.platform.function.console().sendMessage("§c|")
|
// taboolib.common.platform.function.console().sendMessage("§c|")
|
||||||
|
//
|
||||||
taboolib.common.platform.command.command("idebug") {
|
// taboolib.common.platform.command.command("idebug") {
|
||||||
literal("clean") {
|
// literal("clean") {
|
||||||
execute<org.bukkit.entity.Player> { sender, _, _ ->
|
// execute<org.bukkit.entity.Player> { sender, _, _ ->
|
||||||
transaction {
|
// transaction {
|
||||||
SchemaUtils.drop(InviteCodes)
|
// SchemaUtils.drop(InviteCodes)
|
||||||
SchemaUtils.create(InviteCodes)
|
// SchemaUtils.create(InviteCodes)
|
||||||
sender.sendMessage("§a| §7成功清空数据库")
|
// sender.sendMessage("§a| §7成功清空数据库")
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
literal("rename") {
|
// literal("rename") {
|
||||||
dynamic {
|
// dynamic {
|
||||||
execute<org.bukkit.entity.Player> { sender, _, arg ->
|
// execute<org.bukkit.entity.Player> { sender, _, arg ->
|
||||||
transaction {
|
// transaction {
|
||||||
InviteCode.find { InviteCodes.uid eq sender.uniqueId }.first().run {
|
// InviteCode.find { InviteCodes.uid eq sender.uniqueId }.first().run {
|
||||||
name = arg
|
// name = arg
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
Loading…
Reference in New Issue