Open checkcast opened 1 month ago
I don't quite understand, can you try to give me some examples?
I don't quite understand, can you try to give me some examples?
Currently, each line could be represented as a String
, but we could (optionally) support Adventure Component
which represents rich text (clickable, hoverable, HEX colors). In most cases users only need HEX colors and nothing more.
Very simple example to create a component:
Component component = MiniMessage.miniMessage().deserialize("<yellow><bold>Hello <reset>world!");
Which will result in:
holoeasy
It could be great if we could provide such component
as line in holoeasy
like:
Component component = MiniMessage.miniMessage().deserialize("<yellow><bold>Hello <reset>world!");
hologramPool.registerHolograms(() -> {
hologram(location, () -> {
textline("test");
componentline(component);
});
});
Currently we only have a workaround by using dirty hack LegacyComponentSerializer
:
private static final LegacyComponentSerializer SERIALIZER = LegacyComponentSerializer.builder()
.character(LegacyComponentSerializer.SECTION_CHAR)
.useUnusualXRepeatedCharacterHexFormat()
.hexColors()
.build();
hologramPool.registerHolograms(() -> {
hologram(location, () -> {
textline("test");
textline(SERIALIZER.serialize(MiniMessage.miniMessage().deserialize(("<rainbow>||||||||||||||||||||||||</rainbow>"))));
});
});
Result is:
But in my opinion this doesn't look good and might be an unreliable solution.
Hi, I think it would be a great idea to be able to use Adventure components and/or minimessages in Holoeasy.