From b954ccea63a0e8cb9dbcf234601d65b58777b4ca Mon Sep 17 00:00:00 2001 From: Kamicjusz Date: Fri, 24 May 2024 14:51:20 +0200 Subject: [PATCH 1/7] add PlaceholderAPI support in internal placeholders expand default config --- build.gradle.kts | 2 +- .../formatter/config/PluginConfig.java | 62 ++++++++++++------- .../placeholder/PlaceholderRegistry.java | 10 +-- .../placeholder/PlaceholderStack.java | 4 +- 4 files changed, 45 insertions(+), 33 deletions(-) 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/src/main/java/com/eternalcode/formatter/config/PluginConfig.java b/chatformatter-core/src/main/java/com/eternalcode/formatter/config/PluginConfig.java index a35cc73..71cfa02 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 @@ -6,8 +6,11 @@ import com.google.common.collect.ImmutableMap; import com.eternalcode.formatter.ChatSettings; import com.eternalcode.formatter.placeholder.PlaceholderStack; +import me.clip.placeholderapi.PlaceholderAPI; import net.dzikoysk.cdn.entity.Description; +import org.bukkit.entity.Player; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -25,7 +28,7 @@ public class PluginConfig implements ChatSettings, PlaceholderStack, TemplateRep public boolean receiveUpdates = true; - @Description({ " ", "# Chat format for ranks (Vault) Support mini-messages and legacy colors" }) + @Description({ " ", "# Chat rankFormat 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" }) @@ -44,31 +47,40 @@ public class PluginConfig implements ChatSettings, PlaceholderStack, TemplateRep "# RGB and gradient message usage: ", "# Example message", "# Example message", - " " + "# ", + "# You can use three more placeholders: ", + "# " }) - public String defaultFormat = "{displayname} {arrow_right} {message}"; - 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