Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Freya Arbjerg <[email protected]>
  • Loading branch information
topi314 and freyacodes authored Oct 12, 2023
1 parent 05eed1b commit 97e77d2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion LavalinkServer/application.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins:
lavalink:
plugins:
# - dependency: "com.github.example:example-plugin:1.0.0" # required, the coordinates of your plugin
# repository: "https://maven.example.com/releases" # optional, defaults to the Lavalink release repository
# repository: "https://maven.example.com/releases" # optional, defaults to the Lavalink releases repository by default
# snapshot: false # optional, defaults to false, used to tell Lavalink to use the snapshot repository instead of the release repository
# pluginsDir: "./plugins" # optional, defaults to "./plugins"
# defaultPluginRepository: "https://maven.lavalink.dev/releases" # optional, defaults to the Lavalink release repository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ class PluginManager(val config: PluginsConfig) {

val declarations = config.plugins.map { declaration ->
if (declaration.dependency == null) throw RuntimeException("Illegal dependency declaration: null")
if (declaration.repository == null) {
declaration.repository = if (declaration.snapshot) config.defaultPluginSnapshotRepository else config.defaultPluginRepository
}
val fragments = declaration.dependency!!.split(":")
if (fragments.size != 3) throw RuntimeException("Invalid dependency \"${declaration.dependency}\"")
val repository =

var repository = declaration.repository
?: if (declaration.snapshot) config.defaultPluginSnapshotRepository else config.defaultPluginRepository
repository =
if (declaration.repository!!.endsWith("/")) declaration.repository!! else declaration.repository!! + "/"
Declaration(fragments[0], fragments[1], fragments[2], repository)
}
Expand Down
14 changes: 7 additions & 7 deletions PLUGINS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,30 @@ for instructions.

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

## Official plugin repository
## Distributing your plugin

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.
The repository has a release (https://maven.lavalink.dev/releases) and snapshot (https://maven.lavalink.dev/snapshots) repository which you can use to publish your plugin.
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.
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.

```yaml

lavalink:
plugins:
- dependency: "com.github.example:example-plugin:1.0.0" # required, the dependency to your plugin
repository: "https://maven.example.com/releases" # optional, defaults to the Lavalink release repository
repository: "https://maven.example.com/releases" # optional, defaults to https://maven.lavalink.dev/releases for releases
snapshot: false # optional, defaults to false, used to tell Lavalink to use the snapshot repository instead of the release repository
```
The default repository can also be overwritten in your `application.yml` file.
The default repositories can also be overridden in your `application.yml` file.

```yaml
lavalink:
defaultPluginRepository: "https://maven.example.com/releases" # optional, defaults to the Lavalink release repository
defaultPluginSnapshotRepository: "https://maven.example.com/snapshots" # optional, defaults to the Lavalink snapshot repository
defaultPluginRepository: "https://maven.example.com/releases" # optional, defaults to https://maven.lavalink.dev/releases
defaultPluginSnapshotRepository: "https://maven.example.com/snapshots" # optional, defaults to https://maven.lavalink.dev/snapshots
```

Additionally, you can overwrite the default plugin folder where Lavalink saves the downloaded plugins, or loads them from.
Additionally, you can override the default plugin path where Lavalink saves and loads the downloaded plugins.

```yaml
lavalink:
Expand Down

0 comments on commit 97e77d2

Please sign in to comment.