Skip to content

Commit 487e3e4

Browse files
committed
Improve SVC group handling
1 parent 39916b2 commit 487e3e4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/kotlin/xyz/bluspring/unitytranslate/compat/voicechat/SimpleVoiceChatCompat.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package xyz.bluspring.unitytranslate.compat.voicechat
22

33
import de.maxhenkel.voicechat.api.ForgeVoicechatPlugin
4+
import de.maxhenkel.voicechat.api.Group
45
import de.maxhenkel.voicechat.api.VoicechatPlugin
56
import de.maxhenkel.voicechat.api.VoicechatServerApi
67
import de.maxhenkel.voicechat.api.events.EventRegistration
@@ -53,15 +54,20 @@ class SimpleVoiceChatCompat : VoicechatPlugin {
5354
return source.serverLevel().getPlayers {
5455
(!isPlayerDeafened(it) &&
5556
((it.distanceToSqr(source) <= voiceChatServer.voiceChatDistance * voiceChatServer.voiceChatDistance && UTVoiceChatCompat.areBothSpectator(source, it)) ||
56-
playerSharesGroup(it, source))
57+
playerSharesGroup(source, it))
5758
)
5859
|| it == source
5960
}
6061
}
6162

6263
fun playerSharesGroup(player: ServerPlayer, other: ServerPlayer): Boolean {
6364
val firstGroup = voiceChatServer.getConnectionOf(player.uuid)?.group ?: return false
65+
if (firstGroup.type == Group.Type.OPEN)
66+
return true
67+
6468
val secondGroup = voiceChatServer.getConnectionOf(other.uuid)?.group ?: return false
69+
if (secondGroup.type == Group.Type.ISOLATED && firstGroup.id != secondGroup.id)
70+
return false
6571

6672
return firstGroup.id == secondGroup.id
6773
}

0 commit comments

Comments
 (0)