From cebc482dcb61f3eb42ccf97db0cc385c4ad8753f Mon Sep 17 00:00:00 2001 From: Apehum <36326454+Apehum@users.noreply.github.com> Date: Mon, 4 Nov 2024 16:24:27 +0800 Subject: [PATCH] fix: check wildcard permission before everything else on permission update --- client/changelog.md | 3 ++- proxy/changelog.md | 3 ++- .../server/audio/capture/VoiceServerActivationManager.kt | 6 +++--- server/changelog.md | 3 ++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/client/changelog.md b/client/changelog.md index da2de743..ff0ecdfe 100644 --- a/client/changelog.md +++ b/client/changelog.md @@ -7,4 +7,5 @@ so there’s no need to worry if the server hasn't been updated to 2.1.x. ### Changes in 2.1.2 - Fixed buffer overflow when using AudioSender with delayed first frame. -- Fixed EncoderException on server switch on servers with proxy and proxy-side addons (e.g, groups addon). \ No newline at end of file +- Fixed EncoderException on server switch on servers with proxy and proxy-side addons (e.g, groups addon). +- Fixed `pv.activation.*` permission is not being updated on the client without reconnect. \ No newline at end of file diff --git a/proxy/changelog.md b/proxy/changelog.md index d1e3bb33..51fa8178 100644 --- a/proxy/changelog.md +++ b/proxy/changelog.md @@ -8,4 +8,5 @@ so there’s no need to worry if the server hasn't been updated to 2.1.x. ### Changes in 2.1.2 - Fixed buffer overflow when using AudioSender with delayed first frame. - Fixed client EncoderException on server switch caused by UDP packets sent to a client when client's server is null. -- Fixed ArrayIndexOutOfBoundsException exception when using `/` command on Velocity. \ No newline at end of file +- Fixed ArrayIndexOutOfBoundsException exception when using `/` command on Velocity. +- Fixed `pv.activation.*` permission is not being updated on the client without reconnect. \ No newline at end of file diff --git a/server-proxy-common/src/main/kotlin/su/plo/voice/server/audio/capture/VoiceServerActivationManager.kt b/server-proxy-common/src/main/kotlin/su/plo/voice/server/audio/capture/VoiceServerActivationManager.kt index 1991e817..890818a4 100644 --- a/server-proxy-common/src/main/kotlin/su/plo/voice/server/audio/capture/VoiceServerActivationManager.kt +++ b/server-proxy-common/src/main/kotlin/su/plo/voice/server/audio/capture/VoiceServerActivationManager.kt @@ -191,11 +191,8 @@ class VoiceServerActivationManager( val player = event.player val permission = event.permission - if (activationById.values.none { it.permissions.contains(permission) }) return - if (permission == WILDCARD_ACTIVATION_PERMISSION) { when (player.instance.getPermission(WILDCARD_ACTIVATION_PERMISSION)) { - PermissionTristate.TRUE -> activationById.values.forEach { player.sendPacket(ActivationRegisterPacket(it as VoiceActivation)) } @@ -214,6 +211,9 @@ class VoiceServerActivationManager( } return } + + if (activationById.values.none { it.permissions.contains(permission) }) return + val permissionSplit = permission.split("\\.".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() val activation = getActivationByName(permissionSplit[permissionSplit.size - 1]).orElse(null) ?: return diff --git a/server/changelog.md b/server/changelog.md index 69ba0ade..b7c5e053 100644 --- a/server/changelog.md +++ b/server/changelog.md @@ -6,4 +6,5 @@ Versions 2.0.x and 2.1.x are protocol-compatible, so there’s no need to worry if the server hasn't been updated to 2.1.x. ### Changes in 2.1.2 -- Fixed buffer overflow when using AudioSender with delayed first frame. \ No newline at end of file +- Fixed buffer overflow when using AudioSender with delayed first frame. +- Fixed `pv.activation.*` permission is not being updated on the client without reconnect. \ No newline at end of file