mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-11-13 06:03:59 +01:00
Fix custom placeholders
This commit is contained in:
parent
58907f075f
commit
2789a24295
@ -5,6 +5,7 @@
|
||||
*/
|
||||
package me.filoghost.holographicdisplays.plugin.config;
|
||||
|
||||
import me.filoghost.fcommons.Colors;
|
||||
import me.filoghost.fcommons.MaterialsHelper;
|
||||
import me.filoghost.fcommons.Strings;
|
||||
import me.filoghost.holographicdisplays.plugin.format.DisplayFormat;
|
||||
@ -32,8 +33,9 @@ public class HologramLineParser {
|
||||
hologramLine = hologram.createItemLine(icon, serializedLine);
|
||||
|
||||
} else {
|
||||
// Don't apply display format inside placeholders
|
||||
String displayText = StringWithPlaceholders.withEscapes(serializedLine).replaceStrings(DisplayFormat::apply);
|
||||
String displayText = DisplayFormat.apply(serializedLine, false);
|
||||
// Apply colors only outside placeholders
|
||||
displayText = StringWithPlaceholders.withEscapes(displayText).replaceStrings(Colors::colorize);
|
||||
hologramLine = hologram.createTextLine(displayText, serializedLine);
|
||||
}
|
||||
|
||||
|
@ -25,13 +25,19 @@ import java.util.List;
|
||||
public class DisplayFormat {
|
||||
|
||||
public static String apply(String input) {
|
||||
return apply(input, true);
|
||||
}
|
||||
|
||||
public static String apply(String input, boolean addColors) {
|
||||
if (input == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
input = StaticReplacements.searchAndReplace(input);
|
||||
input = input.replace("&u", "{rainbow}");
|
||||
input = Colors.colorize(input);
|
||||
if (addColors) {
|
||||
input = Colors.colorize(input);
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user