Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
}

Expand All @@ -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;
}

Expand Down