mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-11-15 23:15:10 +01:00
Convert {empty} to an actual placeholder
This commit is contained in:
parent
4399fd90a7
commit
fca1de85e0
@ -59,8 +59,6 @@ public class CreateCommand extends HologramSubCommand {
|
||||
|
||||
if (args.length > 1) {
|
||||
String text = Strings.joinFrom(" ", args, 1);
|
||||
CommandValidate.check(!text.equalsIgnoreCase("{empty}"), "The first line should not be empty.");
|
||||
|
||||
line = hologramEditor.parseHologramLine(hologram, text);
|
||||
player.sendMessage(ColorScheme.SECONDARY_DARKER + "(Change the lines with /" + context.getRootLabel()
|
||||
+ " edit " + hologram.getName() + ")");
|
||||
|
@ -19,7 +19,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
public class HologramLineParser {
|
||||
|
||||
private static final String ICON_PREFIX = "icon:";
|
||||
private static final String EMPTY_LINE_PLACEHOLDER = "{empty}";
|
||||
|
||||
public static InternalHologramLine parseLine(InternalHologram hologram, String serializedLine) throws HologramLoadException {
|
||||
InternalHologramLine hologramLine;
|
||||
@ -30,13 +29,7 @@ public class HologramLineParser {
|
||||
hologramLine = hologram.createItemLine(icon, serializedLine);
|
||||
|
||||
} else {
|
||||
String displayText;
|
||||
if (serializedLine.trim().equalsIgnoreCase(EMPTY_LINE_PLACEHOLDER)) {
|
||||
displayText = "";
|
||||
} else {
|
||||
displayText = DisplayFormat.apply(serializedLine);
|
||||
}
|
||||
|
||||
String displayText = DisplayFormat.apply(serializedLine);
|
||||
hologramLine = hologram.createTextLine(displayText, serializedLine);
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,10 @@ public class DefaultPlaceholders {
|
||||
HolographicDisplays plugin = HolographicDisplays.getInstance();
|
||||
placeholderRegistry.unregisterAll(plugin);
|
||||
|
||||
placeholderRegistry.registerGlobalPlaceholderReplacer(plugin, "empty", Integer.MAX_VALUE, (argument) -> {
|
||||
return "";
|
||||
});
|
||||
|
||||
placeholderRegistry.registerGlobalPlaceholder(plugin, "rainbow", new AnimationPlaceholder(4, toStringList(
|
||||
ChatColor.RED,
|
||||
ChatColor.GOLD,
|
||||
|
Loading…
Reference in New Issue
Block a user