File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
src/main/kotlin/dev/arbjerg/lavalink/client/protocol Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import dev.arbjerg.lavalink.protocol.v4.Track as ProtocolTrack
99
1010internal fun ProtocolTrack.toCustom () = Track (this )
1111
12- data class Track internal constructor(private var internalTrack : ProtocolTrack ) {
12+ class Track internal constructor(private var internalTrack : ProtocolTrack ) {
1313 val encoded = internalTrack.encoded
1414 val userData: JsonNode
1515 get() = internalTrack.userData.toJackson()
@@ -25,4 +25,19 @@ data class Track internal constructor(private var internalTrack: ProtocolTrack)
2525 fun <T > getUserData (klass : Class <T >): T {
2626 return fromJsonElement(internalTrack.userData, klass)
2727 }
28+
29+ /* *
30+ * Clones this [Track] based on the current [ProtocolTrack] from the server. Custom user data will be cloned as well.
31+ */
32+ fun makeClone (): Track {
33+ val clone = Track (
34+ internalTrack.copy(
35+ info = info.copy(position = 0L )
36+ )
37+ )
38+
39+ clone.setUserData(userData)
40+
41+ return clone
42+ }
2843}
You can’t perform that action at this time.
0 commit comments