Skip to content

Commit

Permalink
feat: add placeholderapi for proxy usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 committed Aug 17, 2024
1 parent 5fccd7d commit f96a711
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
2 changes: 2 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ repositories {
maven("https://repo.mineinabyss.com/snapshots")
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://repo.unnamed.team/repository/unnamed-public/")
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
google()
}

Expand All @@ -24,6 +25,7 @@ dependencies {

compileOnly(idofrontLibs.creative.api)
compileOnly(idofrontLibs.creative.serializer.minecraft)
compileOnly("me.clip:placeholderapi:2.11.6")

// Shaded
implementation("com.aaaaahhhhh.bananapuncher714:GifConverter:1.0")
Expand Down
18 changes: 18 additions & 0 deletions core/src/main/kotlin/com/mineinabyss/emojy/EmojyPlaceholders.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.mineinabyss.emojy

import com.mineinabyss.idofront.textcomponents.serialize
import me.clip.placeholderapi.expansion.PlaceholderExpansion
import org.bukkit.OfflinePlayer

class EmojyPlaceholders : PlaceholderExpansion() {
override fun getIdentifier() = "emojy"

override fun getAuthor() = "boy0000"

override fun getVersion() = emojy.plugin.pluginMeta.version

override fun onRequest(player: OfflinePlayer?, params: String): String? {
val emote = emojy.emotes.firstOrNull { it.id == params }?.formattedUnicode() ?: emojy.gifs.firstOrNull { it.id == params }?.formattedUnicode()
return emote?.serialize()
}
}
1 change: 1 addition & 0 deletions core/src/main/kotlin/com/mineinabyss/emojy/EmojyPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class EmojyPlugin : JavaPlugin() {

GlobalTranslator.translator().sources().filter { it.name() == EmojyTranslator.key }.forEach(GlobalTranslator.translator()::removeSource)
GlobalTranslator.translator().addSource(EmojyTranslator())
EmojyPlaceholders().register()
}
}

4 changes: 1 addition & 3 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ dependencyResolutionManagement {
}

versionCatalogs {
create("idofrontLibs"){
from("com.mineinabyss:catalog:$idofrontVersion")
}
create("idofrontLibs").from("com.mineinabyss:catalog:$idofrontVersion")
}
}

Expand Down

0 comments on commit f96a711

Please sign in to comment.