Skip to content

Commit

Permalink
fix colors placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
iiAhmedYT committed Jul 17, 2024
1 parent ccd589f commit d2113ef
Showing 1 changed file with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,25 +117,29 @@ public ColorPlaceholder(
* @param configurationSection The ConfigurationSection containing the style properties.
*/
private void initializeStyle(ConfigurationSection configurationSection) {
this.style = Tag.styling(builder -> {
builder.color(TextColor.fromHexString(hexValue));
final StringBuilder propertiesBuilder = new StringBuilder();
final StringBuilder propertiesPrefixBuilder = new StringBuilder();
final StringBuilder propertiesSuffixBuilder = new StringBuilder();

final List<TextDecoration> decorations = new ArrayList<>();
for (final String decorationType : DECORATIONS_PROPERTIES.keySet()) {
if (configurationSection.getBoolean(decorationType)) {
propertiesBuilder.append(DECORATIONS_PROPERTIES.get(decorationType));
propertiesPrefixBuilder.append("<").append(decorationType).append(">");
propertiesSuffixBuilder.append("</").append(decorationType).append(">");
decorations.add(TextDecoration.valueOf(decorationType.toUpperCase(Locale.ENGLISH)));
}
}

final StringBuilder propertiesBuilder = new StringBuilder();
final StringBuilder propertiesPrefixBuilder = new StringBuilder();
final StringBuilder propertiesSuffixBuilder = new StringBuilder();
this.properties = propertiesBuilder.toString();
this.propertiesMiniPrefix = propertiesPrefixBuilder.toString();
this.propertiesMiniSuffix = propertiesSuffixBuilder.toString();

for (final String decorationType : DECORATIONS_PROPERTIES.keySet()) {
if (configurationSection.getBoolean(decorationType)) {
propertiesBuilder.append(DECORATIONS_PROPERTIES.get(decorationType));
propertiesPrefixBuilder.append("<").append(decorationType).append(">");
propertiesSuffixBuilder.append("</").append(decorationType).append(">");
builder.decorate(TextDecoration.valueOf(decorationType.toUpperCase(Locale.ENGLISH)));
}
this.style = Tag.styling(builder -> {
builder.color(TextColor.fromHexString(hexValue));
for (final TextDecoration decoration : decorations) {
builder.decorate(decoration);
}

this.properties = propertiesBuilder.toString();
this.propertiesMiniPrefix = propertiesPrefixBuilder.toString();
this.propertiesMiniSuffix = propertiesSuffixBuilder.toString();
});
}

Expand Down

0 comments on commit d2113ef

Please sign in to comment.