Skip to content

Commit

Permalink
fix(deps): updated to MiniPlaceholders 2
Browse files Browse the repository at this point in the history
  • Loading branch information
4drian3d committed Mar 12, 2023
1 parent 820ac53 commit f75620d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 32 deletions.
21 changes: 6 additions & 15 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,19 @@ plugins {
}

repositories {
maven("https://repo.papermc.io/repository/maven-public/") {
content {
includeGroup("com.velocitypowered")
}
}
maven("https://jitpack.io") {
content {
includeGroup("com.github.AlessioDP.libby")
}
}
mavenCentral()
maven("https://jitpack.io")
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://repo.alessiodp.com/releases/")
}

dependencies {
compileOnly(kotlin("stdlib"))
compileOnly(libs.velocity)
kapt(libs.velocity)
compileOnly(libs.caffeine)
compileOnly(libs.configurate.hocon)
compileOnly(libs.configurate.kotlin)
compileOnly(libs.miniplaceholders)
compileOnly(libs.miniplaceholders.api)
compileOnly(libs.miniplaceholders.kotlin)

implementation(libs.libby)
implementation(libs.bstats)
}
Expand Down Expand Up @@ -69,7 +60,7 @@ blossom {

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(11))
languageVersion.set(JavaLanguageVersion.of(17))
}
}

11 changes: 5 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata.format.version = "1.1"

velocity = "3.2.0-SNAPSHOT"
bstats = "3.0.1"
caffeine = "3.1.5"

# Plugins
blossom = "1.3.1"
Expand All @@ -15,20 +14,20 @@ runvelocity = "2.0.1"
geantyref = "1.3.13"

configurate = "4.1.2"
libby = "43d25ade72"
libby = "1.1.5"

miniplaceholders = "1.3.1"
miniplaceholders = "2.0.0"

[libraries]

# Compile Only Dependencies
velocity = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" }
bstats = { module = "org.bstats:bstats-velocity", version.ref = "bstats" }
caffeine = { module = "com.github.ben-manes.caffeine:caffeine", version.ref = "caffeine" }
configurate-hocon = { module = "org.spongepowered:configurate-hocon", version.ref = "configurate" }
configurate-kotlin = { module = "org.spongepowered:configurate-extra-kotlin", version.ref = "configurate" }
libby = { group = "com.github.AlessioDP.libby", name = "libby-velocity", version.ref = "libby" }
miniplaceholders = { group = "com.github.4drian3d", name = "MiniPlaceholders", version.ref = "miniplaceholders" }
libby = { group = "net.byteflux", name = "libby-velocity", version.ref = "libby" }
miniplaceholders-api = { group = "io.github.miniplaceholders", name = "miniplaceholders-api", version.ref = "miniplaceholders" }
miniplaceholders-kotlin = { group = "io.github.miniplaceholders", name = "miniplaceholders-kotlin-ext", version.ref = "miniplaceholders" }

[plugins]

Expand Down
21 changes: 10 additions & 11 deletions src/main/kotlin/me/adrianed/clientcatcher/Placeholder.kt
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
package me.adrianed.clientcatcher

import com.velocitypowered.api.proxy.Player
import me.dreamerzero.miniplaceholders.api.Expansion
import me.dreamerzero.miniplaceholders.api.utils.TagsUtils
import io.github.miniplaceholders.kotlin.asClosingTag
import io.github.miniplaceholders.kotlin.expansion
import net.kyori.adventure.text.Component.text
import kotlin.jvm.optionals.getOrNull

fun registerExpansion() {
//TODO: Migrate to MiniPlaceholder ext-kotlin 2.0.0
Expansion.builder("clientcatcher")
.filter(Player::class.java)
.audiencePlaceholder("client") { aud, _, _ ->
TagsUtils.staticTag((aud as Player).clientBrand ?: "")
}
.audiencePlaceholder("mods") { aud, _, _ ->
expansion("clientcatcher") {
filter(Player::class.java)
audiencePlaceholder("client") { aud, _, _ -> text((aud as Player).clientBrand ?: "").asClosingTag() }
audiencePlaceholder("mods") { aud, _, _ ->
val mods = (aud as Player).modInfo.getOrNull()?.mods
TagsUtils.staticTag(mods?.joinToString(", ") { "${it.id}:${it.version}" } ?: "")
}.build().register()
text(mods?.joinToString(", ") { "${it.id}:${it.version}" } ?: "").asClosingTag()
}
}.register()
}

0 comments on commit f75620d

Please sign in to comment.