From 7d9df7187d97332df960c58641443cf928d06465 Mon Sep 17 00:00:00 2001 From: pauldb09 <70904183+pauldb09@users.noreply.github.com> Date: Sat, 28 Jan 2023 10:45:42 +0100 Subject: [PATCH] Feat: Improve perf & rework seekFunction --- .../main/java/lavalink/server/player/LavalinkPlayer.kt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/LavalinkServer/src/main/java/lavalink/server/player/LavalinkPlayer.kt b/LavalinkServer/src/main/java/lavalink/server/player/LavalinkPlayer.kt index e29fef25d..41353739a 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/LavalinkPlayer.kt +++ b/LavalinkServer/src/main/java/lavalink/server/player/LavalinkPlayer.kt @@ -94,7 +94,7 @@ class LavalinkPlayer( override fun seekTo(position: Long) { val track = audioPlayer.playingTrack ?: throw RuntimeException("Can't seek when not playing anything") - track.position = position + track.position = track.position + position } override fun setVolume(volume: Int) { @@ -110,12 +110,7 @@ class LavalinkPlayer( return } - updateFuture = socket.playerUpdateService.scheduleAtFixedRate( - { sendPlayerUpdate(socket, this) }, - 0, - serverConfig.playerUpdateInterval.toLong(), - TimeUnit.SECONDS - ) + } private inner class Provider(connection: MediaConnection?) : OpusAudioFrameProvider(connection) {