diff --git a/plugin/build.gradle b/plugin/build.gradle index a81749a..46c04df 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -74,8 +74,6 @@ dependencies { // PAPI compileOnly 'me.clip:placeholderapi:2.10.10' - - implementation 'org.apache.commons:commons-text:1.12.0' } compileKotlin { diff --git a/plugin/src/main/kotlin/me/gabytm/minecraft/arcanevouchers/functions/Strings.kt b/plugin/src/main/kotlin/me/gabytm/minecraft/arcanevouchers/functions/Strings.kt index 578df60..07b6df9 100644 --- a/plugin/src/main/kotlin/me/gabytm/minecraft/arcanevouchers/functions/Strings.kt +++ b/plugin/src/main/kotlin/me/gabytm/minecraft/arcanevouchers/functions/Strings.kt @@ -9,7 +9,6 @@ import net.kyori.adventure.text.format.TextDecoration import net.kyori.adventure.text.minimessage.ParsingException import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver import net.md_5.bungee.api.ChatColor -import org.apache.commons.lang3.StringUtils import org.bukkit.Bukkit import org.bukkit.Color import org.bukkit.OfflinePlayer @@ -26,11 +25,12 @@ fun String.color(): String { } fun String.replace(args: Map): String { - return this.replace(args.keys.toTypedArray(), args.values.toTypedArray()) + return args.entries.fold(this) { string, (placeholder, value) -> string.replace(placeholder, value) } } fun String.replace(placeholders: Array, values: Array): String { - return StringUtils.replaceEach(this, placeholders, values) + return placeholders.zip(values) + .fold(this) { string, (placeholder, value) -> string.replace(placeholder, value) } } fun String.mini(removeItalic: Boolean = false, customTagResolvers: Set = emptySet()): Component {