From 6338235243c7a3426249b048de5d6a0431d7f737 Mon Sep 17 00:00:00 2001 From: Zarkness2 Date: Wed, 11 Feb 2026 11:46:42 +0100 Subject: [PATCH] feat(placeholder): add list support - Add support for List values in configuration, joined with newlines --- .../placeholder/type/StringPlaceholder.java | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/to/itsme/itsmyconfig/placeholder/type/StringPlaceholder.java b/core/src/main/java/to/itsme/itsmyconfig/placeholder/type/StringPlaceholder.java index ce3f1ec..01d9016 100644 --- a/core/src/main/java/to/itsme/itsmyconfig/placeholder/type/StringPlaceholder.java +++ b/core/src/main/java/to/itsme/itsmyconfig/placeholder/type/StringPlaceholder.java @@ -6,6 +6,8 @@ import to.itsme.itsmyconfig.placeholder.PlaceholderDependancy; import to.itsme.itsmyconfig.placeholder.PlaceholderType; +import java.util.List; + /** * The StringPlaceholderData class represents a placeholder data object for strings. * It extends the PlaceholderData class and provides methods for registering arguments, @@ -27,8 +29,18 @@ public StringPlaceholder( final String filePath, final ConfigurationSection section ) { + super(section, filePath, PlaceholderType.STRING, PlaceholderDependancy.NONE); - this.message = section.getString("value", ""); + + final Object value = section.get("value"); + if (value instanceof List) { + this.message = String.join("\n", section.getStringList("value")); + } else if (value instanceof String) { + this.message = (String) value; + } else { + this.message = ""; + } + this.registerArguments(this.message); } @@ -50,7 +62,16 @@ public String getResult(final OfflinePlayer player, final String[] params) { */ @Override public boolean reloadFromSection() { - this.message = this.getConfigurationSection().getString("value", ""); + + final Object value = this.getConfigurationSection().get("value"); + if (value instanceof List) { + this.message = String.join("\n", getConfigurationSection().getStringList("value")); + } else if (value instanceof String) { + this.message = (String) value; + } else { + this.message = ""; + } + return true; }