Skip to content

Commit 4271d55

Browse files
authored
Merge pull request #975 from lavalink-devs/dev
release 4.0.0-beta.5
2 parents e35993d + eac9878 commit 4271d55

File tree

7 files changed

+57
-9
lines changed

7 files changed

+57
-9
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
Each release usually includes various fixes and improvements.
44
The most noteworthy of these, as well as any features and breaking changes, are listed here.
55

6+
## 4.0.0-beta.5
7+
* Update lavaplayer to [`2.0.3`](https://github.com/lavalink-devs/lavaplayer/releases/tag/2.0.2) - Fixed YouTube access token errors
8+
* Added default plugin repository. Plugin devs can now request their plugin to be added to the default repository. For more info see [here](https://github.com/lavalink-devs/Lavalink/blob/master/PLUGINS.md#distributing-your-plugin)
9+
* Fixed error when seeking and player is not playing anything in
10+
611
## 4.0.0-beta.4
712
* Update lavaplayer to [`2.0.2`](https://github.com/lavalink-devs/lavaplayer/releases/tag/2.0.2) - Support MPEG 2.5 and fixed some requests not timing out
813
* Add `Omissible#isPresent` & `Omissible#isOmitted` to the `protocol` module

LavalinkServer/application.yml.example

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
server: # REST and WS server
22
port: 2333
33
address: 0.0.0.0
4+
http2:
5+
enabled: false # Whether to enable HTTP/2 support
46
plugins:
57
# name: # Name of the plugin
68
# some_key: some_value # Some key-value pair for the plugin
79
# another_key: another_value
810
lavalink:
911
plugins:
10-
# - dependency: "group:artifact:version"
11-
# repository: "repository"
12-
pluginsDir: "./plugins"
12+
# - dependency: "com.github.example:example-plugin:1.0.0" # required, the coordinates of your plugin
13+
# repository: "https://maven.example.com/releases" # optional, defaults to the Lavalink releases repository by default
14+
# snapshot: false # optional, defaults to false, used to tell Lavalink to use the snapshot repository instead of the release repository
15+
# pluginsDir: "./plugins" # optional, defaults to "./plugins"
16+
# defaultPluginRepository: "https://maven.lavalink.dev/releases" # optional, defaults to the Lavalink release repository
17+
# defaultPluginSnapshotRepository: "https://maven.lavalink.dev/snapshots" # optional, defaults to the Lavalink snapshot repository
1318
server:
1419
password: "youshallnotpass"
1520
sources:

LavalinkServer/src/main/java/lavalink/server/bootstrap/PluginManager.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,13 @@ class PluginManager(val config: PluginsConfig) {
4747
data class Declaration(val group: String, val name: String, val version: String, val repository: String)
4848

4949
val declarations = config.plugins.map { declaration ->
50-
if (declaration.dependency == null || declaration.repository == null) throw RuntimeException("Illegal declaration $declaration")
50+
if (declaration.dependency == null) throw RuntimeException("Illegal dependency declaration: null")
5151
val fragments = declaration.dependency!!.split(":")
5252
if (fragments.size != 3) throw RuntimeException("Invalid dependency \"${declaration.dependency}\"")
53-
val repository =
53+
54+
var repository = declaration.repository
55+
?: if (declaration.snapshot) config.defaultPluginSnapshotRepository else config.defaultPluginRepository
56+
repository =
5457
if (declaration.repository!!.endsWith("/")) declaration.repository!! else declaration.repository!! + "/"
5558
Declaration(fragments[0], fragments[1], fragments[2], repository)
5659
}

LavalinkServer/src/main/java/lavalink/server/bootstrap/PluginsConfig.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ import org.springframework.stereotype.Component
88
class PluginsConfig {
99
var plugins: List<PluginDeclaration> = emptyList()
1010
var pluginsDir: String = "./plugins"
11+
var defaultPluginRepository: String = "https://maven.lavalink.dev/releases"
12+
var defaultPluginSnapshotRepository: String = "https://maven.lavalink.dev/snapshots"
1113
}
1214

1315
data class PluginDeclaration(
1416
var dependency: String? = null,
15-
var repository: String? = null
17+
var repository: String? = null,
18+
var snapshot: Boolean = false
1619
)

LavalinkServer/src/main/java/lavalink/server/player/PlayerRestHandler.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,10 @@ class PlayerRestHandler(
124124
// we handle position differently for playing new tracks
125125
playerUpdate.position.takeIfPresent { encodedTrack is Omissible.Omitted && playerUpdate.identifier is Omissible.Omitted }
126126
?.let {
127-
player.seekTo(it)
128-
SocketServer.sendPlayerUpdate(context, player)
127+
if (player.isPlaying) {
128+
player.seekTo(it)
129+
SocketServer.sendPlayerUpdate(context, player)
130+
}
129131
}
130132

131133
playerUpdate.endTime.takeIfPresent { encodedTrack is Omissible.Omitted && playerUpdate.identifier is Omissible.Omitted }

PLUGINS.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,36 @@ for instructions.
1919

2020
You can add your own plugin by submitting a pull-request to this file.
2121

22+
## Distributing your plugin
23+
24+
The official plugin repository is hosted on https://maven.lavalink.dev. If you want to publish your plugin there, please reach out to us via [Discord](https://discord.gg/ZW4s47Ppw4) for credentials.
25+
The Lavalink team has release (https://maven.lavalink.dev/releases) and snapshot (https://maven.lavalink.dev/snapshots) repositories which you can use to publish your plugin.
26+
By default, Lavalink will look for the plugin in the Lavalink repository, but you can also specify a custom repository for each plugin in your `application.yml` file.
27+
28+
```yaml
29+
30+
lavalink:
31+
plugins:
32+
- dependency: "com.github.example:example-plugin:1.0.0" # required, the dependency to your plugin
33+
repository: "https://maven.example.com/releases" # optional, defaults to https://maven.lavalink.dev/releases for releases
34+
snapshot: false # optional, defaults to false, used to tell Lavalink to use the snapshot repository instead of the release repository
35+
```
36+
37+
The default repositories can also be overridden in your `application.yml` file.
38+
39+
```yaml
40+
lavalink:
41+
defaultPluginRepository: "https://maven.example.com/releases" # optional, defaults to https://maven.lavalink.dev/releases
42+
defaultPluginSnapshotRepository: "https://maven.example.com/snapshots" # optional, defaults to https://maven.lavalink.dev/snapshots
43+
```
44+
45+
Additionally, you can override the default plugin path where Lavalink saves and loads the downloaded plugins.
46+
47+
```yaml
48+
lavalink:
49+
pluginsDir: "./lavalink-plugins" # optional, defaults to "./plugins"
50+
```
51+
2252
## Developing your own plugin
2353

2454
> **Note:**

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fun VersionCatalogBuilder.spring() {
3636
}
3737

3838
fun VersionCatalogBuilder.voice() {
39-
version("lavaplayer", "2.0.2")
39+
version("lavaplayer", "2.0.3")
4040

4141
library("lavaplayer", "dev.arbjerg", "lavaplayer").versionRef("lavaplayer")
4242
library("lavaplayer-ip-rotator", "dev.arbjerg", "lavaplayer-ext-youtube-rotator").versionRef("lavaplayer")

0 commit comments

Comments
 (0)