Skip to content
This repository has been archived by the owner on Apr 27, 2021. It is now read-only.

Commit

Permalink
クールタイムが解消されない問題を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
sya-ri committed Feb 21, 2021
1 parent d3ed2f7 commit 0994fb1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
id("net.minecrell.plugin-yml.bukkit") version "0.3.0"
}

version = "1.0.0"
version = "1.0.1"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ object DiscordClient {
val uuidPlayer = UUIDPlayer.from(player)
if (muteCoolTime.contains(uuidPlayer)) return null
muteCoolTime.add(uuidPlayer)
plugin.runTaskLater(10, true) {
plugin.runTaskLater(10) {
muteCoolTime.remove(uuidPlayer)
}
val guild = guild ?: return "ギルドが見つかりませんでした"
Expand All @@ -86,7 +86,7 @@ object DiscordClient {
val uuidPlayer = UUIDPlayer.from(player)
if (moveCoolTime.contains(uuidPlayer)) return null
moveCoolTime.add(uuidPlayer)
plugin.runTaskLater(15, true) {
plugin.runTaskLater(15) {
moveCoolTime.remove(uuidPlayer)
}
val guild = guild ?: return "ギルドが見つかりませんでした"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,13 @@ object AutoGroupOnMove : EventRegister {
if (coolTime.contains(uuidPlayer)) return@event
updateConnectChannel()
coolTime.add(uuidPlayer)
plugin.runTaskLater(5, true) {
plugin.runTaskLater(5) {
coolTime.remove(uuidPlayer)
}
}
}
}

private var lastConnectChannel = mapOf<UUIDPlayer, Long>()

private fun updateConnectChannel() {
val voiceMemberList = DiscordMember.playerList.toMutableSet()

Expand Down Expand Up @@ -106,19 +104,16 @@ object AutoGroupOnMove : EventRegister {
}
}

if (lastConnectChannel != connectChannel) {
connectChannel.forEach { (uuidPlayer, channel) ->
val player = uuidPlayer.player ?: return@forEach
connectChannel.forEach { (uuidPlayer, channel) ->
val player = uuidPlayer.player ?: return@forEach
DiscordClient.move(player, channel)
}
voiceMemberList.forEach {
val player = it.player ?: return@forEach
val channel = ownerToChannel[null]
if (channel != null) {
DiscordClient.move(player, channel)
}
voiceMemberList.forEach {
val player = it.player ?: return@forEach
val channel = ownerToChannel[null]
if (channel != null) {
DiscordClient.move(player, channel)
}
}
lastConnectChannel = connectChannel
}
}
}

0 comments on commit 0994fb1

Please sign in to comment.