Skip to content

Commit 4df24c8

Browse files
authored
Merge pull request #626 from FxRayHughes/patch-4
Add replacePlaceholder methods for String and List
2 parents 92d3345 + 23aee29 commit 4df24c8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

module/bukkit/bukkit-hook/src/main/kotlin/taboolib/platform/compat/PlaceholderExpansion.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@ import taboolib.common.util.unsafeLazy
1515
import taboolib.platform.BukkitPlugin
1616
import java.util.function.Supplier
1717

18+
fun String.replacePlaceholder(): String {
19+
return try {
20+
PlaceholderAPI.setPlaceholders(null, this)
21+
} catch (ex: NoClassDefFoundError) {
22+
this
23+
}
24+
}
25+
26+
fun List<String>.replacePlaceholder(): List<String> {
27+
return try {
28+
PlaceholderAPI.setPlaceholders(null, this)
29+
} catch (ex: NoClassDefFoundError) {
30+
this
31+
}
32+
}
33+
1834
fun String.replacePlaceholder(player: Player): String {
1935
return try {
2036
PlaceholderAPI.setPlaceholders(player, this)

0 commit comments

Comments
 (0)