diff --git a/build.gradle.kts b/build.gradle.kts index ff63316..59e23be 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -85,7 +85,7 @@ runPaper { } tasks.runServer { - minecraftVersion("1.20.1") + minecraftVersion("1.20.4") dependsOn("shadowAll") pluginJars = files("/build/libs/ChatFormatter v${project.version}.jar") } diff --git a/chatformatter-core/build.gradle.kts b/chatformatter-core/build.gradle.kts index 7ede731..070844f 100644 --- a/chatformatter-core/build.gradle.kts +++ b/chatformatter-core/build.gradle.kts @@ -34,7 +34,12 @@ dependencies { // JUnit 5 testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.2") + testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.2") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.2") + testImplementation("org.mockito:mockito-core:5.12.0") + testImplementation("org.mockito:mockito-junit-jupiter:5.12.0") + testImplementation("me.clip:placeholderapi:2.11.5") + testImplementation("org.assertj:assertj-core:3.26.0") } tasks { diff --git a/chatformatter-core/src/main/java/com/eternalcode/formatter/ChatFormatterPlugin.java b/chatformatter-core/src/main/java/com/eternalcode/formatter/ChatFormatterPlugin.java index f5a10b2..c2398e1 100644 --- a/chatformatter-core/src/main/java/com/eternalcode/formatter/ChatFormatterPlugin.java +++ b/chatformatter-core/src/main/java/com/eternalcode/formatter/ChatFormatterPlugin.java @@ -4,6 +4,7 @@ import com.eternalcode.formatter.config.PluginConfig; import com.eternalcode.formatter.legacy.LegacyPostProcessor; import com.eternalcode.formatter.legacy.LegacyPreProcessor; +import com.eternalcode.formatter.placeholder.ConfiguredPlaceholderAPIStack; import com.eternalcode.formatter.placeholder.PlaceholderAPIStack; import com.eternalcode.formatter.placeholder.PlaceholderRegistry; import com.eternalcode.formatter.rank.ChatRankProvider; @@ -39,7 +40,7 @@ public ChatFormatterPlugin(Plugin plugin) { PluginConfig pluginConfig = configManager.getPluginConfig(); this.placeholderRegistry = new PlaceholderRegistry(); - this.placeholderRegistry.stack(pluginConfig); + this.placeholderRegistry.playerStack(new ConfiguredPlaceholderAPIStack(pluginConfig)); this.placeholderRegistry.playerStack(new PlaceholderAPIStack()); this.templateService = new TemplateService(pluginConfig); this.rankProvider = new VaultRankProvider(server); diff --git a/chatformatter-core/src/main/java/com/eternalcode/formatter/config/PluginConfig.java b/chatformatter-core/src/main/java/com/eternalcode/formatter/config/PluginConfig.java index a35cc73..90ca698 100644 --- a/chatformatter-core/src/main/java/com/eternalcode/formatter/config/PluginConfig.java +++ b/chatformatter-core/src/main/java/com/eternalcode/formatter/config/PluginConfig.java @@ -5,13 +5,12 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.eternalcode.formatter.ChatSettings; -import com.eternalcode.formatter.placeholder.PlaceholderStack; import net.dzikoysk.cdn.entity.Description; import java.util.List; import java.util.Map; -public class PluginConfig implements ChatSettings, PlaceholderStack, TemplateRepository { +public class PluginConfig implements ChatSettings, TemplateRepository { @Description(" ") @Description("# ____ _ _ _____ ChatFormatter _ _ ") @@ -28,8 +27,10 @@ public class PluginConfig implements ChatSettings, PlaceholderStack, TemplateRep @Description({ " ", "# Chat format for ranks (Vault) Support mini-messages and legacy colors" }) @Description({ " ", "# We're recommending to use webui for mini-messages: https://webui.adventure.kyori.net/" }) @Description({ " ", "# documentation is here: https://docs.adventure.kyori.net/minimessage/format.html" }) + @Description({ " ", "# You can check LuckPerms setup and placeholders here: https://luckperms.net/wiki/Placeholders" }) @Description({ + "# ", "# Example usages:", "# ", "# Hover message:", @@ -44,31 +45,43 @@ public class PluginConfig implements ChatSettings, PlaceholderStack, TemplateRep "# RGB and gradient message usage: ", "# Example message", "# Example message", - " " + "# ", + "# You can use three more internal placeholders: ", + "# " }) - public String defaultFormat = "{displayname} {arrow_right} {message}"; + public String defaultFormat = "{displayname} » {message}"; + @Description({ " ", "# Here you can set different formats for each rank.", + "# Remember! Rank name must be exactly the same as in you permission plugin configuration.", + "# If player have more than one rank remember to correctly setup rank weight configuration" }) public Map format = new ImmutableMap.Builder() - .put("default", "{member} &f{displayname} &8{arrow_right} {message} ") - .put("admin", "$template({admin}, &c)") - .build(); - - - @Description({ " ", "# It is used to shorten the text even more and keep the clean file!" }) - public List