#adventure-help

1 messages · Page 11 of 1

lime ermine
#

and in-case something changes with the material and it can't find the item, there's an error thrown in the console + the item isn't air but it's set to bedrock (as sort of precaution for even a human-error mistake)

boreal orchid
#

would avoid all of that by using the key and then doing:

StreakItem:
  Lose:
    type: "minecraft:diamond"
    Display: "<c:#8cc1cd>Streak: <red><streak>"
    Lore:
    - "the lore"
  Win:
    Material: "gold_ingot"
    Display: "<c:#8cc1cd>Streak: <green><streak>
ItemStack item;
ItemType type = Registry.ITEM.get(Key.key(type));
if (type != null)
  item = type.createItemStack();
else
  item = ItemStack.empty();
#

benefit also that it filters out block types (since they're on a separate registry), so you don't have to worry about things like accidentally creating an ItemStack with a block type

lime ermine
#

That looks interesting, I'll take a look at that

sweet hornet
#

Still, this is an interesting one. When you append something to <red>Text, you expect it get inherit the red styling, while when you append it to <red>Text</red>, you expect the red styling to get closed and thus not inherited. But that's not true, because in fact the 2 syntax (closed and unclosed) are strictly equivalent! This is a kind of bias from the brain thinking that the append occurs at the "MM-encoded string" level, when in reality it occurs at component level

#

If you wanted to keep the standard formatter that returns inserting tags instead of selfClosingInserting for some reason, you would've to write: You have <type:won:lost></type> <type:'<green><streak>':'<red><streak>'></type> coinflips

#

Which isn't pretty, yeah

boreal orchid
#

I had to look at the debug output and couldn't understand what was going on lol, but that makes sense

#

made a test case and everything

coarse echo
#

Can someone please help me to find a RedStone Limiter?
I need a 1.21.1 PaperMC plugin to limit the redstone usage cuz there are some players with a big redstone farms and server is lagging even with 10GB ram. Can someone send a RedStone Limiter Plugin link to this thread? Ping me please.

sweet hornet
#

#paper-help but honestly idk if this server is the right place to ask for plugins

winter socket
#

how do I flatten a component while keeping its styles? basically to turn the first box to the second

sweet hornet
#

In your example, Component#compact() should do it

winter socket
#

oh lol, thanks!

sweet hornet
#

But the example you shown contains no style also 😅

#

Compacting will preserve the style, but the result won't necessarily be "flat"

winter socket
#

yeah it was just an example thing to test why these two components aren't equal

#

is there another way to do this? (guh did I xy myself)

sweet hornet
#

It'll be a visually identical equivalent component, generally smaller in size to represent in memory

#

Basically it's hard to test true visual equality

#

If that's what you want to achieve

#

But why would you want that

winter socket
#

so I should try to flatten both components before comparing?

winter socket
#

the idea of "components" is not really exposed

sweet hornet
#

Compacting both component could help yes, but there are case where two visually equals components won't be structurally equals, even after compaction

winter socket
#

if it helps reduce these cases I'm all for it, a good enough solution, thank you :)

sweet hornet
#

And couldn't you get out by comparing your technical representation (your data model BEFORE it gets turned into visual components for players)?

#

If you see what I mean

winter socket
#

this isn't really applicable in my case but I appreciate it!

hexed field
#

minecraft:blocks atlas works

#

oh, is it only in 1.21.11? i'm on 1.21.10. nice.

hexed field
#

is there any way to tell if a block/item is in the atlas? i know this is something that only the client knows but want to not have to manage a list myself manually

sweet hornet
#

As discussed here, there’s not an easy way, no

sage pivot
#

follow up to this but i believe doing this would change the title of what im using is there a way to make a copy?

#

im looking a custom inventory view right now just tryna derive some information from the title

tidal river
#

how does one convert BinaryTag to String or Json?

sweet hornet
sage pivot
#

oh i see

wicked torrent
#

implement InventoryHolder instead, checking titles or generally using components for data storage like that is an anti-pattern

sage pivot
stark badger
tidal river
#

MinestomAdventure has a utility function

river orchid
#

Hey, is there an scenario where MiniMessage#deserialize can return something that is not a TextComponent?
(I'm assuming it is returning a TextComponent, tbh idk)

sweet hornet
#

Why?

river orchid
#

Because I need a TextComponent, and I have the suspicion that doing something like this may not be safe:

TextComponent firstComponent = (TextComponent) MiniMessage.miniMessage().deserialize(first);
sweet hornet
#

This doesn't tell why

river orchid
#

I don't understand what you mean then, could you elaborate please? Why what?

sweet hornet
#

Why do you want a text component?

#

Sorry

#

Why do you want to convert the output of MM to a text component?

river orchid
sour totem
#

.. and what do you need the string contents for?

river orchid
#

Oh, ok I think I should explain the entire thing I'm trying to do
I'm experimenting a little bit with packets to modify the MOTD of the server
For the PacketType.Status.Server.RESPONSE (in packetevents) I only have a json, which expects a "text" field for the MOTD.
I gave paper source a quick read to see how they handle this and found this:

PlainTextContents.create(((TextComponent) this.adventure).content())

Which is later used in the minecraft chat component

I'm not yet entirely sure if the result of TextComponent#content is what I need for this, but this was part of the experiment ig paperOhhh

sweet hornet
#

If you want to extract the plain text from a component, you can use the PlainTextComponentSerializer

#

It'll erase all the style and special objects, and only keep texts

river orchid
#

I was expecting to preserve colors, styles and other text features like heads/sprites

sweet hornet
#

I think you could achieve a similar result when starting from an MM-encoded string by using MiniMessage#stripTags, which may be simpler

#

iirc MOTD does not support components, so you'd have to use legacy encoding (LegacyComponentSerializer)

river orchid
#

it does actually, give me a min (look at my head in the motd)

sweet hornet
#

Or it is now possible since recent update maybe

sour totem
#

you can use the gson component serializer to turn any component into json which packetevents seems to need, but we've also got some longstanding api in paper for ping responses you should consider using

river orchid
# sour totem you can use the gson component serializer to turn any component into json which ...

Actually, this started due to this issue:
https://github.com/PaperMC/Paper/issues/8073
I found a workaround using PacketType.Play.Server.SERVER_DATA and then got the idea to do the same but for PacketType.Status.Server.RESPONSE

GitHub

Expected behavior Paper supports RGB color codes in the MOTD that is displayed in the client's server list. This is an extension on vanilla servers which don't support RGB in MOTD at all. T...

#

Basically doing everything using packets looked like a fun challenge, so I'm now giving it a try based

jolly sage
#

a really specific and odd use case: what would the best way to add markers into components, invisible to the players (in a tooltip for example) but so that plugins can use them to figure out a "meaning" of that component
I want to use this for lores, and there can be arbitrary other data in the lore, so when parsing the lore I want to mark some lines so when parsing the same lore in the future, the plugin knows which lore lines to find/modify/avoid/whatever

sweet hornet
#

Just don't

#

Components are visual elements, not a storage system

#

To store arbitrary data on an item (because you talked about lore), you can use PDC

#

You can access that data from plugins, and even see it in the vanilla item data if you want to, for debugging purpose

#

And many more elements supports PDC, not just items

jolly sage
#

that's exactly true
but in my scenario it does not make sense to store such data on the item :(
let me give somewhat of an example: a "super ender pearl" which requires a player to have at least 100 experience levels to use it
when a player without that much xp is holding it, there appear some lines in the lore saying exactly that, "You need 100 XP levels to use this item"
but when he drops that item to someone who has 100 xp or he gets 100 xp himself that lore must disappear, and the plugin will know exactly which lines to remove, without removing the rest of the lore
sure it can, instead of lore, be a chat message, but that would be just for "using" an item, there's a lot of other possibilities

#

right now I'm consindering adding a content="" component with a very specific color as a first child of the main component but i'll think about this more tomorrow

cloud vapor
#

You'll find it much easier to simply recreate the lore from scratch when needed

jolly sage
#

wouldn't it break with arbitrary items for which the user may have manually edited the lore (/data modify ...)?

boreal orchid
#

I would recommend just using PDC like teo suggested then just listen to the PlayerInventorySlotChangeEvent to check whether the data needs to be updated

primal apex
#

Is it possible to scale the head from the head tag to a other size?

sweet hornet
#

No, but if you put it on a text display of course you can scale the text display. In other contexts (chat, lore, dialog UI…) the size is fixed, like regular texts

sage tiger
#

Is there any guide about custom audience?

sweet hornet
#

What do you have trouble with? And what are you trying to use custom audiences for?

sage tiger
#

It seems that I was looking for ForwardingAudience 😅

muted nymph
#

who is kyori

sand drift
#

it's an organisation

sweet hornet
fleet rose
#

how do I display horizontal lines with no breaks in the chat like in this image?

cloud vapor
#

I believe that's just strikethrough on spaces

fleet rose
#

ah thanks that worked

dire dove
inland heron
#
miniMessage = MiniMessage.builder()
  .tags(Placeholder.component("primary", Component.translatable("palette.primary")))
  .tags(Placeholder.component("secondary", Component.translatable("palette.secondary")))
  .tags(Placeholder.component("error", Component.translatable("palette.error")))
  .tags(Placeholder.component("prefix", Component.translatable("prefix")))
  .build();

GlobalTranslator.translator().addSource(new LocaleMessageTranslator(miniMessage, this, key));

is there a proper way to do this because i know this wont work and i'm probably not doing it right

sweet hornet
#

You are overriding tags every time

#

Your MM instance only have prefix

#

You should use MiniMessage.builder().editTags(tags -> { ... })

#

Furthermore, I believe you want the style of the prefix to influence the rest of the message, so you should use a Tag.inserting(...) tag resolver instead of Placeholder.component(...)

wary hollow
#

how do you show items (like pickaxes) on the server list using minimessage? I've tried <sprite:blocks:item/snowball> and it works, but something like <sprite:items:item/diamond_pickaxe> doesn't, and neither does the official example <sprite:"minecraft:items":item/porkchop>

torpid robin
#

thats why snowball works and the other two dont

sweet hornet
torpid robin
#

oh crap thats good to know

near horizon
sweet hornet
#

It was experimental, they said it. And now they improved it be splitting the two atlases

#

(Tomorrow)

inland heron
#

anyone know how to get this working

boreal orchid
boreal orchid
#

you're using it, my bad

#

had a stroke reading the first codeblock due to indentation

boreal orchid
#

is there a reason you aren't just using a MiniMessageTranslationStore

fiery oracle
fiery oracle
#

what platform & version of adventure are you using?

inland heron
inland heron
inland heron
fiery oracle
#

it's a consumer so it's not like there's a value being returned, so it compiles

inland heron
#

ah

boreal orchid
fiery oracle
#

oh yea that file says pallet, lol

inland heron
#

OH

#

i feel so stupid now

fiery oracle
#

i mean if it makes you feel better, i also missed that

inland heron
#

yeah it works now

#

thank you

boreal orchid
#

I missed it the first time, but after looking at the LocaleMessageTranslator class, I assumed something else was wrong since it looked fine so I looked harder

boreal orchid
# inland heron yeah it works now

if you want to have the IDE yell at you for keys that don't exist on the resource bundle, you can use the jetbrains annotations thingy and an util method like so:

public static Component tr(
    @PropertyKey(resourceBundle = "messages") String key,
    Object... args
) {
    return Component.translatable(key, args);
}
#

this will make it error if you use a key that isn't in the bundle messages

#

also lets you do tab completion on the keys in the resource bundle

inland heron
boreal orchid
#

the above approach won't work for it but it is what it is

inland compass
sweet hornet
tough peak
#

Is there a way to replace a text inside string white still retaining it as a string? I want to use the TagResolver on a string without trning it into a component

fiery oracle
#

why?

sand drift
#

I mean, String.replace?

#

if you want to use component manipulation then you need the component tree

#

I mean, you would be better off writing a custom tag for that given that you'd likely need to deal with PAPI expansion fun

tough peak
#

oh right

midnight spire
#

is adventure 4.26 not deployed to central?

sour totem
midnight spire
#

I see. I guess I use snapshot for now but imo there should be a manual deploy done to not cause more confusion lol

jolly sage
#

I switched from TranslationStore.messageFormat to MiniMessageTranslationStore.create to be able to use minimessage in the resource bundles but now all arguments are missing, they show up as {0} ingame too both in chat and in item lores where i explicitly invoke the global translator

#

Is this supposed to be like that and how do I get the arguments to work?

jolly sage
#

guess that's it lol thank you
I just looked at the subclasses of TranslationStore in my ide and noticed the minimessage and used it xD

rich merlin
#

Are color tags like <red> supported in the server.properties motd string?

sweet hornet
#

Have you tried it?

boreal orchid
sweet hornet
#

Vanilla won't support it, but plugins might do dark magic to add support to it I guess

boreal orchid
rich merlin
prisma mason
rich merlin
#

I just asked out of curiosity. I don't need it to be possible.

#

But thank you 🙂

flint panther
#

When i want to display certain items in chat, can i get the sprite path from an itemStack?
<sprite:blocks:block/diamond_block> will show a diamond block. But <sprite:blocks:block/skeleton_skull> does not show the skeleton skull. I also tried items:item/.. but also not working. Is that even possible?

boreal orchid
#

I know teo send something of a workaround for that in here though, let me see if I can find it

#

here it is

#

they didn't send the whole thing it seems which is a shame

flint panther
#

ah i see, but I cant find something for the skeleton_skull for example

sterile star
#

Isn't it actually skeleton_head or something like that?

flint panther
#

at least not skeleton_head

boreal orchid
#

some items simply don't have a sprite, that might be one of them

flint panther
#

could be, sadly

quaint monolith
#

Yeah a lot of the variants don't, like you might just have the base head item

flint panther
#

is there any other way to display an item in the chat except the sprites?

#

something that also prints the amount there?

quaint monolith
#

Sprites or custom font

sweet hornet
#

And yes no skeleton skull item or block sprite, but MHF_Skeleton player head thankfully

flint panther
#

i tried my custom resource pack images with the sprite tag, does not seem to work, intentionally or is it usually working with resource packs?

sweet hornet
#

Have you made an atlas?

flint panther
#

yes, the blocks atlas

#

afaik it merges locally in the client

sweet hornet
#

You added your textures to the blocks atlas?

flint panther
#

yea, the textures are working properly on the items so it must be working

sweet hornet
#

I managed to get them to work when I played with them like a month earlier, so it’s possible, but I can’t tell exactly how I did it, it was pretty exploratory on my side

flint panther
#

ok, might have messed it up somewhere

#

found it, thx, i messed it up 😄

river orchid
#

Did 1.21.11 change how sprites work?
This minimessage tag <sprite:item/salmon> works fine on 1.21.10 clients, but renders "no texture" in 1.21.11 clients
And the other way around, the tag <sprite:"minecraft:items":item/salmon> works fine on 1.21.11 clients, but renders the unknown character square on 1.21.10 clients
Is there a way to print something that can be rendered on both 1.21.10 and 1.21.11?

quaint monolith
#

I think your only way to make something work on both is to ship your own resource pack and only use custom sprites

river orchid
#

I have the sprites on the motd, too early to send the resourcepack
I think I'll have to manage it based on the protocol version until I'm able to drop 1.21.10

boreal orchid
#

Best you can do is just toggle the atlas depending on the version

#

Reason why it shows no texture now might be because blocks is the default atlas and you’re trying to use an item sprite

lunar yew
#
final Component homeComponent = Component.text(nameOfHome)
                            .hoverEvent(HoverEvent.showText(
                                    Component.text(
                                            plugin.getConfigManager()
                                                    .getMessage("please-select-home-hover")
                                                    .replace("%home%", nameOfHome)
                                    )
                            )).clickEvent(ClickEvent.runCommand("/home " + nameOfHome));

What am I doing wrong? I'm trying to show text in the hover and when they click have the player run a command. I'm getting Cannot resolve method 'showText(TextComponent)' inside te HoverEvent.showText() block

sweet hornet
#

Technically you should be able to remove the HoverEvent.showText(...) wrapper and do directly .hoverEvent(Component.text(...))

#

But this doesn't explain why you can't call the method yourself

lunar yew
#

and it compiled

#

Oh also do you know if the / in front of the command is required in this case?

ClickEvent.runCommand("/home " + nameOfHome)

sweet hornet
#

Yes you need it

lunar yew
#

Perfect thx!

river orchid
normal hemlock
#

Umm

#

is it possible to do something like this <click:copy_to_clipboard:<code>><code></click>?

#

essentially copy a placeholdeR?

rare sage
#

iirc you want to use a Placeholders.unparsed for that one

long python
#

hey isnt there like a web demo of adventure?

sweet hornet
long python
#

tysm!

#

wait

#

how was it made

#

oh wait theres a gh

austere berry
#

how can you display a players head in minimessage?

hexed field
#

is anyone able to get a ClickEvent#suggestCommand to work in a Dialog ActionButton? It doesn't appear to do anything for me, and almost seems like it is not working because it doesn't close the player's open dialog
if they don't work in Dialogs, is there a way to suggest a command to through a bukkit method?

boreal orchid
#

ah wait, suggest command, not execute command

#

does that even work anywhere else than chat

hexed field
#

yeah, i am trying to use the staticAction

#

well, i'm sure it would work if it closed the dialog first

boreal orchid
#

like, for it to work on dialogs or books, it'd have to open chat window for the player

#

I sincerely doubt mojang accounted for that

#

guess it is worth a try

hexed field
#

has mojang not added a way to suggest a command to the player outside of the specific clickevent

boreal orchid
#

not that I remember, I am checking rn

#

they have not it seems

hexed field
#

this is so sad

rugged leaf
#

I'm processing text within components, like this:

fun traverse(text: Component, consumer: BiConsumer<String, Int>) {
    text.replaceText {
        var pos = 0
        it.match(".+").replacement { matchResult, _ ->
            val everything = matchResult.group()
            val prevPos = pos
            pos += everything.length
            consumer.accept(everything, matchResult.start() + prevPos)
            return@replacement Component.text(everything)
        }
    }
}

Just recently someone reported an issue where the whole server looks to have frozen, here's the stack (I cut out the end of the stack):
https://gist.github.com/Thorinwasher/8b2945cab749fe1078e595ab048fb3e5

  • Does there exist a better alternative to traverse components (I need to know the global char-pos, which is a bit of a weird requirement for components)?
    Or
  • Is this an issue with adventure, can this be fixed?
#

For more context:

  • I need to modify the text in multiple ways, to obscure text. It's a game mechanic for making a recipe that can be found in loot more interesting.
  • Recipes of the same type should be merge able, where no previous data is lost in the merging
  • Therefore the global position is necessary to know, it's both used in the database and in merge processing
rugged leaf
#

Might be this exact trace if the traversing is repeated a lot 🤔

sand drift
#

I mean, it's farily hard to say with a truncated log

#

if all of the other traces are showing it's stuck in the same code then you would generally need to work out why

#

Nothing there suggests anything is directly wrong, just depending on the input complexity that might hurt

rugged leaf
#

Yep 🤔 , could just have randomly pointed to that stack at that moment of time

rugged leaf
# sand drift if all of the other traces are showing it's stuck in the same code then you woul...

Maybe testing with a profiler gives clearer statistics on this, getting server freezes like this seems like it's going to be a bit sporadic though. I get the feeling something could be wrong in the plugin, it's fairly un-optimized. Problem is that all of the text processing is randomly determined by generating a seed (which is used pseudorandomly)

Also now that I think about it, I should initialize the .+ pattern statically (I thought that was a cheap operation to do for simple patterns, might not be)

rare sage
#

compiling that pattern won't really be an issue tbh although it is good practice, it also isn't what was caught in that stack trace, but, anything could've been

rugged leaf
#

Oh, yeah that's true 👍

I also don't think matching all chars in a string would be an expensive operation, so the issue might be elsewhere

rare sage
#

you could also use the Component#iterator/iterable methods here and checking if the iterator element is a TextComponent

rugged leaf
#

Anyhow, "might" is a bad word to use in programming, bad habit of mine. I definitely need to test this

rare sage
#

unless you plan on actually replacing the text, then replaceText is not a good fit for this :d

rugged leaf
#

I think I just used it as I'm unsure what components can have text inside of them, how components render, and so on. But if it's only text components, then that's set

rare sage
#

oh, VirtualComponents exist too

#

you probably want to ignore those

rugged leaf
#

Alright, I will rewrite that to something of the type DFS or BFS then. 👍

lucid torrent
#

yo

#

so unless i'm missing something v4.26.0 has been released but not published to maven central?

#

oh

#

has it been published to a different repo?

sterile rampart
#

no

robust wharf
#

there are uuhm, operational challanges

#

I wanted to give it another look today

robust wharf
#

ha I think I have a fix

robust wharf
#

I have now released adventure 4.26.1, which is identically to 4.26.0 plus the CI fix

#

javadocs are still pending, more work needed for that

#

(cc @lucid torrent)

lucid torrent
#

yo thx

dull python
#

does Component.translatable from a MiniMessageTranslationStore return serialized minimessage or a parsed one? i would like to think its parsed already, but i want to confirm

#

also how do i have per-player defaults for Component.translatable locale? i want to have something like
Translatable is called, returns in Locale A if player has set from a command, otherwise returns in locale B (locale of the client) and locale C as the overlord fallback

sand drift
#

I don't think that level of fallback is supported, the expectation is to just use the clients locale, or fallback to whatever the server is set to or something like that

sweet hornet
#

It's not the first time people asks for a server-side client locale tho. Would it be possible to hook a custom Function<Player, Locale> into the translator to allow this?

tiny bone
#

doing sprite:item/name_tag doesnt seem to work in paper 1.21.11 anymore, it returns the texture not found texture

#

worked perfectly in 1.21.10

sour quarry
tiny bone
#

okay. thx!

sweet hornet
#

(You can shorten a little bit this to only <sprite:items:item/name_tag>)

#

You could also create your own shortcut <item_sprite:name_tag>

cloud vapor
#

so you'd just make some sort of util function that can create those pointered instances for you

floral nexus
#

hello I need to serialize String to TextColor.
I'd like the string to jsut be

"&0-9" or "#RRGGBB"

should I do a switch and manually asign either (NamedTextColor) or TextColor.fromHexString(string) for hex string

#

or is there other magical way

fiery oracle
#

what's the string for?

#

er rather, what's the color for?

floral nexus
#

I need to apply the color to components, but first I need to serialize it from the config

tawny bolt
#

Why not just use Minimessage?

floral nexus
#

because it would make my config super ugly for what I need to do

#

complex serialization that needs to be human readable and editable

#

and what would that change if I still need a TextColor not a Serialization

fiery oracle
#

what?

#

mini message is a human readable format, so im not sure what you mean by that?

floral nexus
#

it doesnt matter. I'd like to serialize simple String like "&f" or "#RRGGGBB" to TextColor object

fiery oracle
#

ok - and what if you want to specify a non-color style?

wet kestrel
#

"human readable" and "&a" don't belong in the same sentence without negation. 🙁

fiery oracle
#

say, a shadow color? or italics? or bold?

#

are you going to add separate options for that?

floral nexus
fiery oracle
#

it's why i asked for additional context
i don't know what is the case
but generally, specifying a single color in a config (is your problem even a user-facing config? i don't know, hence why i asked) is an anti-pattern

tawny bolt
#

there is a TextColor#fromCSSHex or similar, see the Javadocs. You can use that for the #RRGGBB format

tawny bolt
#

the other format hasn't been used by the game in like 12 years now and is not user-friendly, just don't

#

(and if you really want to, yeah what you suggest initially is probably the "best" way)

floral nexus
#

thanks that's exactly what I needed.

dapper bay
#

hi! The player head, head: thingy is for only 1.21.9+ ?

midnight spire
#

yes

cyan ice
#

Hi, how to get a shield rendered correctly as a sprite? It's maybe to hacky right? Because u need to tell that it has the normal wood color and no pattern?

shield_patterns has only this entries:

  "sources": [
    {
      "type": "minecraft:single",
      "resource": "minecraft:entity/shield_base"
    },
    {
      "type": "minecraft:single",
      "resource": "minecraft:entity/shield_base_nopattern"
    },
    {
      "type": "minecraft:directory",
      "prefix": "entity/shield/",
      "source": "entity/shield"
    }
  ]
midnight spire
#

I don't think there is a good way beyond some hacky stuff with negative spaces

cyan ice
dapper bay
midnight spire
#

@dapper bay seeing as you shouldn't be using any version older than 1.21.10 anymore it's not really that big of an issue?

dapper bay
#

a lot of player base is generally in .8/.4/.1

midnight spire
#

only if you let them

dapper bay
#

it would be okay if there is support for .8 at least...

midnight spire
#

well we haven't invented time travel yet

sweet hornet
# dapper bay thats really bad :/

What do you expect then? We're not working at Mojang Studio, they released head components in 1.21.9, so adventure provides support for them since they exist

dapper bay
#

makes sense

#

right now

dull python
#

can i get some feedback from you guys on what i can improve?

sweet hornet
#

Please ask specific question on which topic you need help, because we don't have time to review an entire project 😅

dull python
compact matrix
#

Hello, I'm looking for clarification around comparisons when Virtual Components are involved. Based on the documentation for the emitVirtuals method for a MiniMessage builder, it sounds like you should be able to compare Components deserialized from the same MiniMessage instance. However, this does not seem to be the case.

Considering an example:

MiniMessage mm = MiniMessage.builder()
    .strict(false)
    .emitVirtuals(true)
    .tags(StandardTags.defaults())
    .build()

// the following is false
mm.deserialize("<rainbow>Hello").equals(mm.deserialize("<rainbow>Hello"))

Looking through MiniMessage source, it appears that equality checks haven't been implemented. Is it intended or expected that components like this can't be compared? Do I need to compare the serialized (string) output instead?

Feel free to ping me in any replies

sweet hornet
#

I don’t have the time currently to look at your whole question, but maybe this could help you re-think your problem: why would you ever need to compare components…??

compact matrix
#

Is there a "better" way for comparing the something like the name of an item for example against a string (or component)? For context: this is for Skript. I don't expect that kind of comparison to be common, but it does happen, and I would prefer to preserve compatibility for users.

cloud vapor
#

Yeah we don't support component comparison like that, emitVirtuals is intended for roundtrip serialising of e.g. gradients/rainbows to produce the same output as the initial input

#

I assume Skript has a way to store data in the PDC or similar of an item

#

That's how you should be doing comparisons

compact matrix
#

Yeah that would be the recommended approach for analyzing data ofc

cloud vapor
#

And the supported way yes

compact matrix
#

Though I'm sure there are users still doing name comparisons

compact matrix
cloud vapor
#

There are still a lot of users doing unsupported things, unfortunately we don't have the time or space to support everything unintended - we provide/point towards better solutions and support those instead

compact matrix
#

For sure I get that. I think, for compatibility purposes, instead analyzing the serialized content should suffice

#

I figured I would ask here just before resorting to that

cloud vapor
#

PDC has been around for years and years, that's actually got more compatibility than components tbh

compact matrix
#

I should clarify this is not for a script I'm writing - this is for the language itself. I'm integrating Adventure/MiniMessage into the codebase, but need to tie up compatibility for existing user code

cloud vapor
#

I'd still suggest a one-time migration to store identifiers into PDC

wet kestrel
#

I would see nothing wrong with breaking compatibility with bad design.

compact matrix
#

We have the ability to deprecate inadvisable code, so I think we can take that route with eventual removal. I appreciate the insight 🙂

cloud vapor
#

Happy to help 🫡

primal apex
#

Is there a way to set a new minimessage prefix? e.g <> to {}?
Because im working on a little gui creator for my projects and every gui is based in XML, and XML doesnt like <> characters

sweet hornet
#

Not really no

primal apex
#

So the best way would be by finding things such as {} with a regex pattern and replace it by <> right?

#

I mean yeah i can escape <> characters in xml, but in big config that looks terrible

sweet hornet
#

I guess, but it could cause unexpected behavior if the user uses a real &lt;/&gt;

wet kestrel
#

I imagine there wouldn't be overlap between the xml tags you're using for the gui and the MM tags though, theoretically you could pull it all off looking like xml

sweet hornet
#

Isn't there something like <![CDATA[...]]> which allow for anything inside?

primal apex
#

Thanks for the help anyway!

wet kestrel
#

Honestly I think I'd find it reasonable to see like (just using html example) <div><span><b>meow</span></div> and have the <b>meow run through MM

cloud vapor
#

Most XML parsers I've used before should let you read contents as strings ignoring the tags when you're at certain places

gritty belfry
#

Hello, can I somehow get a collection of players/receivers from an Audience from an AsyncChatEvent?

wet kestrel
#

Assuming you mean paper's event, the viewers set is, I think, unique players (and maybe the server too? lost track). Further paper api questions belong in #paper-dev

sterile star
#

Unless I am misremembering, which is very likely, they just kept the items under the default blocks atlas

sweet hornet
#

Each orientation has one

sterile star
tiny bone
sweet hornet
#

So <sprite:items:item/compass_00>...

tiny bone
#

thx!

tiny bone
#

hmm

sweet hornet
#

Mb

#

Fixed it

tiny bone
#

aa i see

sweet hornet
mental vineBOT
sweet hornet
#

It's the debug atlas file generated from 1.21.11

#

(And if you want to see the actual sprites, but just try them out in-game it's easier 😅)

tiny bone
#

yeah thx, i will indeed try them out ingame

#

saved that txt

#

now i can just ez search for it

sweet hornet
#

And because there's no magic, you can find in the vanilla resource pack (assets/minecraft/atlases/items.json) how it is generated:

{
  "sources": [
    {
      "type": "minecraft:directory",
      "prefix": "item/",
      "source": "item"
    },
    {
      "type": "minecraft:paletted_permutations",
      "palette_key": "minecraft:trims/color_palettes/trim_palette",
      "permutations": {
        "amethyst": "minecraft:trims/color_palettes/amethyst",
        "copper": "minecraft:trims/color_palettes/copper",
        "copper_darker": "minecraft:trims/color_palettes/copper_darker",
        "diamond": "minecraft:trims/color_palettes/diamond",
        "diamond_darker": "minecraft:trims/color_palettes/diamond_darker",
        "emerald": "minecraft:trims/color_palettes/emerald",
        "gold": "minecraft:trims/color_palettes/gold",
        "gold_darker": "minecraft:trims/color_palettes/gold_darker",
        "iron": "minecraft:trims/color_palettes/iron",
        "iron_darker": "minecraft:trims/color_palettes/iron_darker",
        "lapis": "minecraft:trims/color_palettes/lapis",
        "netherite": "minecraft:trims/color_palettes/netherite",
        "netherite_darker": "minecraft:trims/color_palettes/netherite_darker",
        "quartz": "minecraft:trims/color_palettes/quartz",
        "redstone": "minecraft:trims/color_palettes/redstone",
        "resin": "minecraft:trims/color_palettes/resin"
      },
      "textures": [
        "minecraft:trims/items/helmet_trim",
        "minecraft:trims/items/chestplate_trim",
        "minecraft:trims/items/leggings_trim",
        "minecraft:trims/items/boots_trim"
      ]
    }
  ]
}
#

Which means basically that every texture from the assets/minecraft/textures/item/ folder is mapped to an item sprite

#

Which explains why there's a ton of sprites for the compass (and clock)

polar nebula
sterile star
# polar nebula

Idk, check using regex and find the first match that matches a tag

#

The tag pattern is openly accessible

sour totem
#

string.equals(mm.escapeTags(string)) might work

polar nebula
#

I see, thanks!

sweet hornet
#

(Note that I don't need/want any recognition if you want to use the pre-generated mappings, they're freely available in the releases)

vivid junco
#

Hi, I've already added Adventure as a dependency. How can I make the plugin's inventory title use a custom font?

wet kestrel
vivid junco
#

Add the dependency to the pom.

wet kestrel
# vivid junco Paper I would say

No need to add adventure (in fact, best not). Just use Paper API as dependency. There are createInventory methods that take Component titles. For more Paper API help, visit #paper-dev 🙂

subtle condor
#

which event is that? Also the PlayerCustomClickEvent?

rare sage
#

it would be that event, yes, though the callback system is preferable

subtle condor
#

well I cant use it because I'm using minimessage through a config

#

so I have to do <click:custom ....

rare sage
#

sure

#

then the event is fine to use

subtle condor
#

do you know what the correct syntax is?

#

like minimessage

rare sage
#

no idea

#

does it even allow for custom click events? 😄

subtle condor
#

afaik yes

rare sage
#

probably something like <click:custom:'namespace:key'> of i had to guess

subtle condor
subtle condor
#

lemme test that

rare sage
#

but right now it does support deserialization

subtle condor
#

yh

#

but I linked it cuz of this

rare sage
#

yes, for serialization

#

not deserialization

#

and it will be supported for serialization in adventure 5 which is not yet finished

subtle condor
#

hm I see

cloud vapor
#

if you're doing the code why don't you just make a callback click event and add it as a custom tag or something

subtle condor
#

I need to be able to pass dynamic data to it

#

for instance:

"You got a friend request by PlayerX [Accept] [Deny]" here I somehow need to be able to get the action (Accept) and the player PlayerX as well as the executor

wet kestrel
#

I'd just style that like <accept>[Accept]</accept> <deny>[Deny]</deny> and then have fun tagresolvers for that.

subtle condor
#

okay but how does the tag resolver know which player to accept or for instance which server to join / clan to join

#

also its not like im using accept or deny for one thing only
it should be used for multiple systems

wet kestrel
#

I'd be making a resolver that can be aware of the players involved and have the callback already know it rgb_shrug

subtle condor
#

hm

#

and what about executing commands?

#

is it possible to disable that popup

#

and also replace placeholders inside of <click:run_command:'/friend accept <player>'>

#

because I already have commands for all actions

wet kestrel
#

I mean, basically yeah you'd make <accept> a tag resolver that adds a ClickEvent to that text that runs that command with the player name on it.

#

And the command popup doesn't happen if the commands are properly registered and sent to the client, iirc?

cloud vapor
#

Yep

subtle condor
#

alr yea it actually works without a popup

#

then I only have one issue left

#

When I hardcode the clan command argument it worked without a warning popup

but here

You have been invited to the clan <primary><clan></primary> by <primary><inviter></primary>!\n<click:run_command:'/clan join <clan>'><green>[Accept]</green></click>

at tag resolvers Placeholder.unparsed("clan", clan.name())

#

the issue is here that in the message <clan> gets replaced with the actual clan name "test"

but inside of the click: tag it doesnt

which makes sense cuz its a tag inside of a tag? --------> <click:run_command:'/clan join <clan>'>

is there an easy way to fix that?

cloud vapor
#

So you'd want to use a pre process parsed placeholder

subtle condor
#

yea that works

#

tysm

subtle condor
boreal orchid
#

funny, what you did is exactly like its impl:

wet kestrel
#

I wouldn't do either, because that's easy for a user to mess up compared to making a tagresolver that auto makes the clickable command, like <join><green>[Accept]</green></join> which is also more readable. Obviously workshop other names like <joinclick> <joincommand> etc.

primal apex
#

I created a dynamic TagResolver using the method below and am using the #deserialize method with the created TagResolver, but it is not being parsed in the game

#

Someone has a idea why?

sand drift
#

unparsed is for a literal string, you probably meant to use parsed

sterile star
#

Tbh I don't think they did

#

This feel like some nested resolver stuff

primal apex
#

thanks lol

sterile star
#

Well nvm I did not say anything

gritty belfry
#

Hello, I'm using net.kyori:adventure-api:4.26.1 and there does not appear to be PlainTextComponentSerializer (at least that's how I vividly remember it's called.) I'm outside of any mod/plugin ecosystem (it's a library for a plugin)

Is there a way to convert Adventure's component into a plain string?

wet kestrel
gritty belfry
wet kestrel
#

That's where I got the ID to copy/paste, so yes I think so 🙂

gritty belfry
#

thanks

robust wharf
#

the javadocs for 4.26.0/1 are now on the jd site, sorry for the delay

tulip wedge
robust wharf
#

that would depend on the platform I would say

tulip wedge
#

im on paper, testing right now

robust wharf
#

why do you care, its an implementation detail

#

but on paper it would be a set action bar text packet

tulip wedge
#

doing some client-side stuff

#

thats why

fathom mulch
#

im looking to make a mutable component, how would i do that?

wet kestrel
#

For what reason?

upper tinselBOT
fathom mulch
# wet kestrel For what reason?

adding components to my skript addon, by skript standards you should be able to modify an object so immutability is not amazing in my case

#

someone else already did it but they wrapped the component in another class, looking to avoid that

#

was thinking of using the componentbuilder interface

#

would that be appropriate?

wet kestrel
#

Builder potentially solves your problem. But this feels like a design flaw to expect everything is mutable.

boreal orchid
#

it is similar to minimessage but predates it

#

unless you mean to add getters/property expressions for a given component string, which I guess could be useful

fathom mulch
fathom mulch
boreal orchid
#

I would just make a component serializer for their format and add some kind of expression like f%string% if that's allowed

polar nebula
#

I am a bit confused, how would I create a tag <example> that has access to everything after it?

#

for instance for text replacement.

wet kestrel
#

Modifying

polar nebula
#

Oh I see, rip no example, time to play around a bit

#

thanks

polar nebula
cloud vapor
#

can you show your code?

polar nebula
#

it's linked

cloud vapor
#

you want to clear the children of the returned component

polar nebula
#

oh I see

#

thanks!

tulip wedge
#

how do we open urls with mini message?

#

<click:open_url:'url'></click>test

#

isnt it this?

wet kestrel
#

You closed the click before th text

tulip wedge
#

ohhhh

#

thx

#

ngl i was looking to the doc but

#

i was searching for "url" in the page

#

im dumb sorry

tardy sequoia
#

Trying to use base64 textures for heads because using the <head:base64> does not work

#

Not quite sure where to start

sterile star
#

The head tag does not yet support base64 textures

tardy sequoia
#

I see! Interesting

#

I was going to use it for chat emojis instead of using the good old fashioned map with unicode characters xD

tardy sequoia
sterile star
#

It will support it as soon as I finally sit down and get named arguments to work, the plan has been to put base64 and other stuff as named arguments

tardy sequoia
sterile star
tardy sequoia
wet kestrel
#

In the short term is is possible to just make your own tag resolver for it though? 🤔

tardy sequoia
sterile star
#

There is Component.object

#

You can construct the object components (like head components) through there

tardy sequoia
#

ohh?

tardy sequoia
sterile star
#

Nowhere yet really. But you can see an example in the head resolver source code, like for example SequentialHeadTag.java, I've linked some lines where the component is constructed

tardy sequoia
#

Wow that's a lot

sterile star
boreal orchid
tardy sequoia
boreal orchid
#

you can also build a custom MiniMessage instance that has it built in I guess

dull python
#

How do I display an item in hover event?

#

From ItemStack

wet kestrel
#

What platform's item stack?

#

(i.e. what API are you using)

dull python
#

Paper

wet kestrel
#

In that case it's already a hover event source.

dull python
#

demn

wet kestrel
#

call itemStack.asHoverEvent() 😉

dull python
#

I better read the docs properly

rare sage
#

better yet, you don't even need to call asHoverEvent! you can just do component.hoverEvent(itemStack) :)

dull python
mystic star
#

Hii, why head is not displaying on chat?

coupon-send-code-player:
  chat:
    - '{header}'
    - <white>
    - <green> <b>[+]</b> Grabbed <yellow>{code}</yellow> <aqua>{template}</aqua> Coupon.
    - <green> <b>[!]</b> Gifting is enabled!
    - <green> <b>[!]</b> Sent coupon to <b><aqua>{player}</aqua>
    - <head:{uuid}>
    - <white>
    - '{footer}'
  sound: coupon.sent-code

where {uuid} replace with player uuid
or i am misunderstood something..

#

here the code i used

override fun sendMessage(sender: CommandSender, path: String, placeHolder: Map<String, String>) {

        val audience = when (sender) {
            is Player -> JService.adventure.player(sender)
            is ConsoleCommandSender -> JService.adventure.console()
            else -> return
        }

        // Get message
        var message = getMessages("$path.chat").apply(placeHolder).joinToString("\n")
        if (message.isEmpty()) message = getMessage("$path.chat").apply(placeHolder)

        if (message.isEmpty()) message = getMessage(path).apply(placeHolder)
        if (message.isEmpty()) message = getTemplateMessage(path).apply(placeHolder)
        if (message.isEmpty()) return
        // Split into lines
        val chatMessage = message.split("\n").map { it.trim() }.filter { it.isNotEmpty() }

        // Actionbar
        val actionBarMessage = getMessage("$path.actionbar").apply(placeHolder).trimStart()
        if (actionBarMessage.isNotEmpty()) {
            audience.sendActionBar(JService.applyMiniColor(actionBarMessage))
        }

        val title = getTitle("$path.title.main", placeHolder)
        if (sender is Player && title.title.isNotBlank()) {
            audience.showTitle(
                Title.title(
                    JService.applyMiniColor(title.title), JService.applyMiniColor(title.subTitle), Title.Times.times(
                        Duration.ofMillis(title.fadeIn), Duration.ofMillis(title.stay), Duration.ofMillis(title.fadeOut)
                    )
                )
            )
        }

        if (sender is Player) {
            val soundSting = getMessages("$path.sound").apply(placeHolder).ifEmpty { JService.configManager.messages.getString("$path.sound")?.apply(placeHolder) }
            val sound = GuiSound.loadSound(soundSting)
            sound.playSound(sender)
        }

        chatMessage.forEach {
            audience.sendMessage(JService.applyMiniColor(it))
        }
    }
#

is it because of use of audience?

cloud vapor
#

Your issue might be how you use placeholders, it's hard to say without seeing more code. MiniMessage has a custom tag system that you should use instead - see the docs for more info

mystic star
# cloud vapor Your issue might be how you use placeholders, it's hard to say without seeing mo...

I just simply replace the text on it

private fun String.apply(placeHolder: Map<String, String>): String {
        var message = this
        placeHolder.forEach { (key, value) ->
            message = message.replace(key, value)
        }
        message = message.replace("{prefix}", prefix)
        message = message.replace("{header}", header)
        message = message.replace("{footer}", footer)
        return message
    }

after all placeholder applied it send the text
I verified that there is no mistake in {uuid}

placeHolder.code = redeemCode.code
placeHolder.uuid = uuid.toString()
cloud vapor
#

the fact the whole line isn't being sent is definitely an indication the problem is on your end rather than adventure/minimessage

#

but just to double check, vanilla client? correct client+server version for the head object components? updated server version?

cloud vapor
#

looks like you're using adventure platform of some sort, spigot i guess?

mystic star
#

papermc - server for testing

cloud vapor
#

you don't need to use adventure-platform if you're using paper, it's possible that could cause issues

cloud vapor
#

also, what does debugging tell you? when you stepped through the code where exactly was the issue?

mystic star
mystic star
cloud vapor
#

okay so what was the component that you sent to the player? did you print that?

#

You're definitely using an up-to-date vanilla client too?

mystic star
mystic star
#

This one?

ObjectComponentImpl{contents=PlayerHeadObjectContentsImpl{name="47dd2cf1-0521-3481-bd5b-18feed752b3c", id=null, profileProperties=[], hat=true, texture=null}, style=StyleImpl{obfuscated=not_set, bold=not_set, strikethrough=not_set, underlined=not_set, italic=not_set, color=null, shadowColor=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}, children=[]}
cloud vapor
#

that looks fine to me then, definitely either an issue in adventure-platform or you're using some modded/custom client that's breaking things

mystic star
#

Oh i think it because the client was cracked

#

now it make sense

cloud vapor
#

wouldn't be surprised if adventure-platform was broken on .10

#

okay great

#

so when i said vanilla right at the start, that's what i meant :p

mystic star
cloud vapor
#

nw, glad you got it sorted

mystic star
upper tinselBOT
mystic star
#

nvm i got anwser from old post

past spire
#

how can i support both legacy color codes and minimessage tags

#

i've tried few things but it didn't work

robust wharf
#

our recommended way is doing a one time migration

#

its called legacy for a reason

civic pine
sand drift
#

resource pack texture

#

i have no idea what that value is even supposed to be

civic pine
#

oh so I can't just use normal head or base64 there yet. OK thanks

sand drift
#

it supports a player UUID, if that's what you mean

#

providing profile info manually is pending on named arguments being supported, (but, that b64 doesn't seem to be anything valid anyways)

boreal orchid
boreal orchid
sweet hornet
#

Is it part of the specs that token emitter ends some tag with a forward /?

#

I mean, is it valid syntax to have like <my_custom_tag:with_arg/>?

#

(It works, but I've never seen that syntax)

sweet hornet
# civic pine

And regarding your case, you might be interested in this custom head tag I've made (but I haven't tested it yet in real world, it's only a prototype as far as now). Main motivation was to have serialization ability.
Example:

private static final MiniMessage mm = MiniMessage.builder()
    .editTags(tags -> tags.resolver(CustomHeadTag.RESOLVER))
    .build();
// Inside my dummy /mm command executor:
Component component = mm.deserialize(String.join(" ", args));
sender.sendMessage(component);
sender.sendMessage(mm.serialize(component));

Obviously the code is not fool-proof, as there's no validation on the argument, but feel free to improve it.
Showcase:

mental vineBOT
boreal orchid
#

I know the built-in tags all implement it, but I don't think I've encoutered cases where I needed to implement that functionality on my custom tags

civic pine
boreal orchid
#

I think the named argument version of the head tag implements the functionality already, it is just not merged yet

civic pine
#

Oh great, but these textures (not base64) would be useful too probably to be pr there

sweet hornet
# boreal orchid I never understood what the whole serializable resolver and component claiming s...

I'm using custom head textures in some item's name/lore, for example to show zombie head on an undead-related weapon, etc.
Custom head textures uses the profile property textures, which is a base64-encoded value containing (along with some other not-so-useful-in-this-context values) the URL to the PNG texture file on Mojang's servers (which is uniquely designated by a probably random (or maybe md5 or something related) hash). They have no UUID nor player name, only the textures property making them static profiles (as opposed to dynamic profiles).

On the other hand, I have an in-game item editor tool for my staff members to create/modify items (namely, their name/lore). This tool relies on Minecraft dialogs, and components are encoded using MiniMessage so it's more user-friendly for them (than JSON or SNBT, for example).

But with the actual builtin head component from MM, such custom head are lost and turned into Steve/Alex heads if the item is edited, because it gets turned into <head> with no argument, and the profile property is lost.

So, TL; DR, yeah I needed to code a serializable tag handling custom heads based on profile property textures

sweet hornet
#

And you must admit it's a bit less cluttered to have :

<custom_head:6ee554abe14fda92ef5ec921222fe60c268a8abdf4120d4f283e803de8d3fe0b>

Than (at least, it can be bigger despite other values not being useful):

<custom_head:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNmVlNTU0YWJlMTRmZGE5MmVmNWVjOTIxMjIyZmU2MGMyNjhhOGFiZGY0MTIwZDRmMjgzZTgwM2RlOGQzZmUwYiJ9fX0=>
sweet hornet
civic pine
sweet hornet
#

Ah, idk about that plugin, maybe they have an API where you can edit the MM instance they use? Otherwise that's a whole another issue, about registering tags into a "global" MM instance 😅

hazy thicket
#

Is there a way to create a text Component with gradient w/o using MiniMessage from-string-deserializer?

#

Something like this

sand drift
#

Well, no, that’s a serialisrr specific feature, Minecraft doesn’t support gradients

#

You would need to modify the component yourself to implement such a feature outside of MM

boreal orchid
cloud topaz
#

Can I use sprites with adventureapi? Don't want to use minimessage since components take less lines in the code

sterile rampart
#

yes

#

If you're hardcoding components, you shouldn't be using mm anyways

#

look at Component.object(...)

cloud topaz
#

The whole adventure vs minimessage thing is confusing to me

#

I get why minimessage is useful for the end user, but in the code base I would rather stick to adventureapi

sterile rampart
#

that's the general idea - mm is a frontend for user input and config files and licalization, but if you don't need those its easier to use components directly

#

It's all adventure components internally though

cloud topaz
#

So in theory you can have icons in rank prefixes now?

steel loom
#

Is it possible to change the tooltip style for hover message component in MM?

sterile rampart
#

@rare sage smh i can spell good

sterile rampart
steel loom
#

No clue, I’ll go research

sage river
#

it's only possible to change tooltip style for itemstacks iirc

#

but you can display an itemstack as a hover event?

steel loom
#

So if I make an itemstack, I should be able to display it through a hover event?

#

With the tooltip style

sage river
#

I think so, but you need a resourcepack

steel loom
#

I have my custom tooltips ready, but thanks I’ll try to make it with an itemstack

marsh oar
#

I have a data object with certain meta data and I wonder how I can write a custom component that does certain things before the string is rendered.
I just want to preprocess certain MetaData before I dump it into placeholders for MiniMessage.

cloud vapor
#

im confused, you're writing a component but you want to make a placeholder for minimessage?

#

can you explain a bit more about what you actually are trying to achieve

marsh oar
#

I just want to throw in an specific object with the content and at the end I have a component that I can simply send

#

On the end I want something like this: context.sender().sendMessage(CustomComponent.of(template)); sender().sendMessage is a method in velocity for example

cloud vapor
#

so, just a util method? yeah ofc you can just do that

hexed crow
#

is there any difference between component.append(component2).append(component3)... with textOfChildren(component1, component2, component3...)? In my plugin the former one sometimes consumes all subsequent components.

bright remnantBOT
sour totem
#

in the first case component would be the parent which 2 and 3 will inherit styling from, textOfChildren would be equivalent to doing Component.empty().append(component).append(component2)... and would result in no style being inherited since the parent is empty

hexed crow
sour totem
#

components are immutable, append returns you a brand new component

boreal orchid
#

the second one creates this one

hexed crow
sweet hornet
#

What you described is component.append(component2.append(component3));

sweet hornet
hexed crow
sweet hornet
#

Nice

polar nebula
#

Hey, so currently I have a way of adding custom placeholders via a config in my Plugin, but for some reason, if I create a placeholder called <secondary_color> that returns <red> and then use that placeholder in a text like <secondary_color>Hello, for some reason, Hello does not show up as red, as if the color gets reset after that. If I make the placeholder return <red>A, only the A will be red, then rest is reset? Any chances somebody could look into how I am doing things:

boreal orchid
#

if you want a tag that only does styling, you'd use a styling tag, if you want a tag that inserts text and its style can be passed down, you'd use an inserting tag

wet kestrel
#

If making custom color placeholders, I'd vote styling placeholder.

frozen tree
#

Hello, why do I get this error on 1.19.2 paper with adventure platform bukkit 4.4.1: https://pastebin.com/EHTdeVWB

AdventureMeta.java:257: this.logger.sendMessage(Component.text(msg));

sage river
#

you need to relocate adventure in your plugin

frozen tree
#

What for? Currently the lib gets downloaded by the server

sterile rampart
#

conflicts with adventure that is bundled with the server

#

adventure-playform-bukkit is completely unnecessary when working with paper servers anyways

frozen tree
#

Is there any other way by not having to realocate the lib in my plugin? I can't deal with the size since we also need the Gson lib which together puts the plugins over 4.5mb

sterile rampart
#

target paper

#

then adventure is included

frozen tree
sterile rampart
sterile rampart
#

and anyways

upper tinselBOT
polar nebula
sweet hornet
patent fable
#

How do I make heads or any sprite using adventure

#

I see minimessage supporting it

forest parrot
wanton marten
#

Does minimessage have support for the Player Object component?

wanton marten
#

I think my need is different to head unless I'm mistaken

I'm basically looking for the minimessage equivalent of {"type":"object","object":"player",player:{name:"playername"},hat:true,color:"#010000",shadow_color:0}

runic onyx
#

should be the right thing, try and see

wanton marten
#

head gives me the flat head of my player, my thing returns (I think) a full skin

sour totem
#

the head tag is the minimessage equivalent of the string you sent

wanton marten
#

Just did some testing and it's the colour giving me the skin image. It's some shader stuff with my resource pack (which I have no clue how it works 😅 ) I'm guessing I just use the minimessage head thing with the right colour hopefully, thank you

desert wing
#

is there any documentation on how to format minimessage and use the new custom click actions? I tried looking on the docs, and couldnt find much about it, (also searching is a pain since it merges with all of other paper's docs and theres no distinction as to wat product the search results are from)

im guessing its something like this <click:custom:'namespace:key'> but how would i add a payload to this?

boreal orchid
#

in this case it seems to have a key argument and a snbt one for the payload

#

so like <click:custom:'idk:whatever':'{"idk":"my payload"}'>

sterile rampart
#

remember that that's the 5.x codebase, I think some of the click event types are less fully supported in MM in the released version

boreal orchid
#

ah, you're right. In the main/4 branch, custom isn't supported since its payload type is custom and the method that MM uses only supports Payload.Text/TextCarrier type actions

#

well, it isn't supported by the built-in tag but you could still make a custom one for it

#

it special-cased changePage action whose payload type is int, I wonder why that wasn't the case for custom. I guess it just didn't make sense given that code was gonna be reworked anyway

sterile rampart
#

custom click events are just newer so it didn't make it in time for the initial release

desert wing
#

makes sense

boreal orchid
sterile rampart
#

don't recommend using internal api

#

it'll break at some point

boreal orchid
#

I mean, that tag is only useful for 4.x, in 5.x you'd just use the click tag

#

but yeah, should be fine without the serializable resolver stuff

frozen tree
#

Is it possible to disable the closing tags(</color>) on LegacyComponentSerializer when de-serializing from a String? Without manually replacing them?

sterile rampart
#

what

frozen tree
#

I know its possible in the MM builder, like miniBuilder.strict(false);

sterile rampart
#

what are you talking about in actual component structure

frozen tree
#

How to disable strict serializing with the LegacyComponentSerializer.Builder?

sterile rampart
#

there's no such concept with legacy

frozen tree
#

Oh, well, then how to disable it when Serializing a Component back to a string?

boreal orchid
#

you can't disable it, it is just how legacy generates components

frozen tree
#

Like I use miniMessage.serialize(legacySerializer.deserialize(String) to translate legacy colors into MM format, but how to prevent the serializer from adding the closing tags

boreal orchid
#

you can't stop it from generating closing tags, since otherwise it'd be a different kind of tree

sweet hornet
boreal orchid
#

&anode A &bnode B &rnode C legacy has no way to indicate that a node is a child of another one, unless you explicitly made a serializer which treated every node as a child of the other, but that wouldn't be how people expect legacy to be parsed

#

if you don't want the closing tags, you can just remove them after serializing, or make an encoder which acts in the way you want. Former is probably easier

#

is there a reason you don't like the closing tags though?

frozen tree
#

Yeah, well, I figured better ask if there was a built in way instead of manually replacing them out of the stringgs

sand drift
#

non-strict will only emit tags when it needs to for the sake of maintaining the component structure

#

(or at least, I think that was the default behavior there)

boreal orchid
#

it is, yeah

frozen tree
boreal orchid
#

if it comes from a config file, just use a string list instead

frozen tree
#

Well, Im not recoding thhat part. Manually replacing the closing tas it is! XD

sand drift
#

newlines inside of components is generally asking for issues

boreal orchid
#

it is fine on chat, just not anywhere else

sand drift
#

I semi recall the behavior there being somewhat inconsistent

frozen tree
sterile rampart
#

yeah text manipulation of the mm output will cause trouble

boreal orchid
#

I also don't understand why you are going legacy -> MM -> Component

sweet hornet
#

I think I understood your XY. And if you have a legacy component like §cThis is\na multi-line\ntext!, it's not a question of closing tag being there or not, it'll be a question of the color only applied to the 1st line

frozen tree
sterile rampart
#

its been 5 years of people being too lazy to implement proper componenr splitting

boreal orchid
#

the PR is there, it just seems that it died to relevance

frozen tree
boreal orchid
#

or just drop legacy and use MM x)

sweet hornet
boreal orchid
frozen tree
boreal orchid
frozen tree
#

MiniMessage doesn't like legacy colors I noticed

sand drift
#

I mean, mojang deprecated legacy colors a decade ago

sweet hornet
sand drift
#

and legacy colors inside of components is stupidly inconsistent

frozen tree
frozen tree
sterile rampart
#

its nothing to do with mm, it's just vanilla

frozen tree
#

Right...

sand drift
#

MM treats them as invalid input, and there is no direct means of transforming legacy to MM due to the nature of the tree

#

many optuse attempts have been made and I guess they work for simple strings, but, we don't recommend or support such manipulation of legacy strings

#

Really, mojang deprecated them a decade ago and we recommend that plugin devs follow the rest of the ecosystem and move on too

frozen tree
#

I like backcompatibility or give users atleast the option to use it

#

Even if it makes my life a little harder

#

Well, I better get back to fixing this...

near valley
#

Are there any news regarding dialog support?

upper tinselBOT
sterile rampart
#

development happens on GH, anything that happens happens there

#

I think paper has its own dialog api for now

tulip wedge
#
        TextComponent settingsComponent = Component.text().build();
        for (FarmerSetting setting : farmer.getFarmerSettings()) {
            settingsComponent = settingsComponent.append(Component.text(setting.name()).clickEvent(ClickEvent.callback(e -> farmer.toggleSetting(setting))));
        }
        TagResolver settings = Placeholder.component("settings", settingsComponent);

How could I make the output like String.join(", ", list)

#

so it would be like Setting1, Setting2, Setting3

tulip wedge
cloud vapor
#

see Component.join

#

so smth like Component.join(JoinConfiguration.commas(true), components)

tulip wedge
#

yeah just saw that

#

thx

cloud vapor
#

If you want the end user to be able to define the format for joining, check the Formatter.joining minimessage tag resolver

tulip wedge
#

not really

near valley
cloud vapor
#

Our current plans are focusing on the 5.x update and then we will start exploring things like dialog/waypoints api, especially now that they seem relatively stable

cloud vapor
#

What does that have to do with Adventure?

north inlet
#

ok sr

#

i will delete it

buoyant arch
#

Helloo, what's the best way to join components?

#

Is there a way through the TextComponent.Builder?

#

Normally I use Component.join()

#

But I have to make a Collection to use that

#

Is there a way in the builder to append new lines for example in between components?

rare sage
#

what's wrong with Component.join? it also takes varargs

buoyant arch
#

There is nothing wrong besides using a Collection instead of a builder

#

Just wondering if there was a better way

#

It does the job, I was just wondering hehe

rare sage
#

you can use the method that doesn't take a collection 🤔

#

what are you looking for and how does the static join method not satisfy you?

buoyant arch
#

I was looking for a JoinConfiguration or something similar on the component builder

#

Just out of comfort really

#

Because I normally use the Builder and I used to do .append("hello").appendNewLine().append("something").build()

#

It's fine tho, using Component.join is the best way I see

#

And doing gradients inside of a Component is possible?

#

I know with MiniMessage it is possible with <gradient>, but inside components?

rare sage
#

there is no api for it, no, there was a pr but it was left unfinished iirc, though mostly done, you could just take a look at it and take whatever useful snippets you might find

#

kind of a scope creep pr imo instead of getting a basic api working first but w/e

buoyant arch
#

🤣 thanks Emily!

jaunty cradle
#

why minimessage gradent with 3 color and 1 to -1 phase it don't make smoth animation (issu on ~4sec, ~8sec, ~12sec),
while 2 color work fine ? (big white number is the phase)

sterile rampart
#

which version

jaunty cradle
#

1st is 3 color <- my issu
2nd is 2 color

sweet hornet
#

Version of adventure

jaunty cradle
#

4.25.0

sweet hornet
#

Have you tried on latest (4.26.1)?

jaunty cradle
#

how could i ? paper is bundled with 4.25.0

ocean agate
#
component = component.replaceText(builder -> builder.match(matcher).replacement(
                            parse(player, keyword, decoration + prefix).append(parse(player, keyword, keyword.replacement())
                                    .hoverEvent(HoverEvent.showText(parse(player, keyword, String.join("<newline>", keyword.descriptions()))))
                            ).append(parse(player, keyword, suffix))
                    )
            );

I'm now using this to replace the text matches regex, but how do I know the input text?

ocean agate
#

nvm figured out

polar nebula
#

Is it possible to cache the tree/structure of a component?

Usage being that I only have some specific placeholders that I want to be reparsed, so MM doesn't have to parse the rest.

sterile star
#

Currently not, but that's something that had been discussed as a possible feature in the future

#

That reminds me, I should finally finish my adventure PRs

polar nebula
boreal orchid
#

people have brought up wanting it however it hasn't been done simply because MM parsing is fast enough to just not bother

sterile star
#

The MM parser already parses it into a tree, the placeholders get handled only after the MM parsing step

boreal orchid
#

though if it comes down to just exposing a method to turn a Node.Root (or whatever it is that deserializeToTree returned) into a Component, then that's probably fine

sterile star
#

It's technically pointless as it's fast anyways, but it's not a particularly intrusive change

polar nebula
#

Yeah

#

I mean it for sure is fast

sterile star
#

Kezz indeed doesn't see a need, but isn't opposed to it being added

#

I've talked about it a while back

polar nebula
#

Never said it wasn't, but squeezing some extra performance by caching doesn't sound bad either lol

sterile star
#

Yeah my opinion too

weak arrow
#

how can i append a child to a component, but make the result not inherit the styles from the parent?

#

these guys are making everyone bold

sweet hornet
#

Children inherit style, you can't change that. But if you have, say, compA and compB, instead of compA.append(compB), you can write Component.empty().append(compA).append(compB)

#

(There are slightly more optimized ways to create an empty component from a set of children, but this is for you to get the idea)

weak arrow
#

exactly what i needed

polar nebula
#

Uhm what would be the best way to make an inserting tag that the content inside would not be parsed by custom tag resolvers, only default MM? For context, I am parsing a string with MM and custom tag resolvers, but I want to make a "blocker" tag, which an user can then use so that inside that tag, the content will not be parsed with the custom tagresolvers. It's mainly to avoid people using tags they aren't supposed to.

last horizon
#

Not entirely sure if I understand you correctly but I think what you are looking for is Placeholder#unparsed

boreal orchid
#

usually when it comes down to not letting users use tags they're not meant to, you just build a MiniMessage instance with the tags they can use

#

interestingly, the Context#deserialize methods which take a TagResolver seems to combine the Context's TagResolver with the one you pass, so you can't really use that

#

you'd have to make a MiniMessage instance that you use separatedly and deserialize the MM with that

polar nebula
polar nebula
cloud vapor
#

yeah see this is why it's best to do stuff not at a packet level haha

#

if you just have an arbitrary string then it's not at all possible to differentiate between user and plugin generated text

polar nebula
polar nebula
cloud vapor
#

yeah we had that in mm years ago but it just doesn't work

#

bc what's stopping the player from just closing the tag

polar nebula
cloud vapor
#

the user can just close that too

#

e.g. <pre:"hello this is">look ive escaped!!!

polar nebula
#

<pre:"hello this is">look ive escaped!!!">

#

would error out no?

cloud vapor
#

what if they just <pre:" at the end

#

the only option is a single tag that prevents parsing for the entire rest of the string without being closed really

#

it's why we removed this kind of tag from mm years ago, it just doesn't work

polar nebula
#

FYI context would be that in a chat plugin for ex. it would be pre:"%msg%" or whatever

polar nebula
#

how would that be implemented though?

#

inserting and self closing tags wouldn't work

cloud vapor
#

modifying probably

#

you might find it easier to fork mm and add a custom parser directive tag ig

polar nebula
#

eh forking was not really in my plans tbf

#

that would mean maintaining it too

cloud vapor
#

yepp

sterile star
#

🍴

polar nebula
cloud vapor
#

modifying tag yea

polar nebula
cloud vapor
#

escape tags will escape any tags known to that minimessage instance

polar nebula
slate current
#

Running into this again now, is there any existing way to do this? Would a PR be accepted (and if so, should it be the default or an additional option)?

#

Because currently, saving a list and then loading it can give a different list (it wraps it on saving and doesn't unwrap on loading)

#

And e.g. Mojang's implementation seems to unwrap on loading by default

buoyant arch
#

Does anyone know when strikethrough works with spaces and when it doesn't

#

I have it sometimes working and others not

#

FRChat.getServerColorGradient(" ").decorate(TextDecoration.STRIKETHROUGH) shouldn't this work as a long dash line?

sweet hornet
#

It might get trimmed, i.e. all heading and trailing white-spaces being removed, which is, in your case, your whole string. So you might need to add a non-white-space at the beginning and/or at the end. I think that a simple dash - should go "under" the strike-through, making it unnoticeable

buoyant arch
#

I will try that, I didn't know there was an auto trim there

#

That was it indeed! Sadly coloring doesn't affect the strike line XD

#

Do you guys know of any character wide enough to look like a full line?

sweet hornet
#

You mean something like that: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯?

cloud vapor
#

it doesn't really matter, just strike through a - or smth

buoyant arch
buoyant arch
#

But does it look like that on minecraft? XD

#

I did the mix and it worked, thanks guys 🙂 I did the dashes + strikethrough

cloud vapor
#

it's coloured whatever the text colour is

charred wagon
#

Hey is there a way to convert the Adventure Component to a minecraft Component

rare sage
#

it depends on the platform impl

#

paper, modded, other adventure-platform artifacts

charred wagon
#

sorry my bad paper

#

i'm on paper

rare sage
#

iirc there are static methods in the internal PaperAdventure class

charred wagon
#

ahh ok

#

i will try

#

thanks

polar nebula
#

what exactly is strict() in MM?

#

javadocs only say it puts it in strict mode

#

what does that do

slate current
# slate current Running into this again now, is there any existing way to do this? Would a PR be...

I understand ya'll do this on your free time and all obviously, and I don't want to be annoying and rush you to reply, but I brought this up for the first time months ago, and would appreciate it if anyone from the team could weigh in if you've got time - unless I'm doing something wrong, this seems like a pretty major issue...

Here is example code to replicate this problem: https://pastes.dev/DtYWadXEDv
Which results in this:

[13:54:24 INFO]: [Plugin]
API Data: BinaryTagType[CompoundBinaryTag 10]{tags={"list"=BinaryTagType[ListBinaryTag 9]{tags=[BinaryTagType[IntBinaryTag 3 (numeric)]{value=5}, BinaryTagType[StringBinaryTag 8]{value="hello"}], type=BinaryTagType[BinaryTag 127]}}}
Post Write: BinaryTagType[CompoundBinaryTag 10]{tags={"list"=BinaryTagType[ListBinaryTag 9]{tags=[BinaryTagType[CompoundBinaryTag 10]{tags={""=BinaryTagType[IntBinaryTag 3 (numeric)]{value=5}}}, BinaryTagType[CompoundBinaryTag 10]{tags={""=BinaryTagType[StringBinaryTag 8]{value="hello"}}}], type=BinaryTagType[CompoundBinaryTag 10]}}}
[13:54:24 INFO]: [Plugin]
NMS Data: {list:[5,"hello"]}
Post Write: {list:[5,"hello"]}
#

I'm happy to work on a fix & PR myself, just want to know what's going on with this first and how you'd want it handled/fixed

sand drift
#

I'm not really sure what the issue is?

slate current
#

NBT Lists with multiple types are wrapped on save ([1, "t"] -> [{"":1}, {"":"t"}]).
For the NMS part, Mojang wraps them on save and then unwraps them when loading, resulting in the same list as expected.
But Adventure NBT only wraps them on save, which means that when reading you basically get a completely different list; ListBinaryTag#unwrapHeterogeneity does exist, but it's not called automatically, and for a deep nested compound with lists inside it it can be very annoying (and sometimes expensive) to handle, as you have to basically recreate the entire thing due to the immutability.

sand drift
#

I believe that part of the general expectation over this stuff is that it should follow vanilla behaviors

slate current
#

Yeah that's what made sense to me as well, just wanted to get confirmation before PRing anything into list loading logic

glossy bough
#
    public void onChat(@NonNull AsyncChatEvent event) {
        var prefix = TagResolver.resolver("prefix", (args, ctx) -> Tag.inserting(getPrefix(event.getPlayer())));

        event.renderer(ChatRenderer.viewerUnaware((player, playerDisplayName, message) -> {
            return
                    MiniMessage.miniMessage()
                            .deserialize("<prefix> <name></prefix> <dark_gray>» <gray><message>",
                                    prefix,
                                    Placeholder.parsed("name", player.getName()),
                                    Placeholder.component("message", message));
        }));
    }

    final Component getPrefix(Player player) {
        LuckPerms lp = LuckPermsProvider.get();

        PlayerAdapter<Player> adapter = lp.getPlayerAdapter(Player.class);

        CachedMetaData metaData = adapter.getMetaData(player);

        String prefix = metaData.getPrefix();

        return MiniMessage.miniMessage().deserialize(prefix);
    }```
why doesnt my color of my prefix continue over to my username
boreal orchid
glossy bough
#

just to continue so your username is the last color of your prefix

boreal orchid
#

hm, wonder if one could just use LinearComponents thing for that

boreal orchid
# glossy bough just to continue so your username is the last color of your prefix
@EventHandler
public void onChat(@NonNull AsyncChatEvent event) {
  var prefix = getPrefix(event.getPlayer());

  event.renderer(ChatRenderer.viewerUnaware((player, playerDisplayName, message) -> {
    return Component.textOfChildren(LinearComponents.linear(prefix, playerDisplayName), Component.text(" » ", NamedTextColor.DARK_GRAY), message);
  }));
}

public Component getPrefix(Player player) {
  LuckPerms lp = LuckPermsProvider.get();

  PlayerAdapter<Player> adapter = lp.getPlayerAdapter(Player.class);

  CachedMetaData metaData = adapter.getMetaData(player);

  String prefix = metaData.getPrefix();

  return MiniMessage.miniMessage().deserialize(prefix);
}

can you try this

#

scrapped the whole MiniMessage stuff since it made the whole thing more confusing than it needed to be, unless you're gonna put the format string into a config it isn't necessary anyway

glossy bough
#

alr to back to normal components

glossy bough
boreal orchid
# glossy bough welp i dont think there is lot more we can do now it dont work

well, if anything you can do this:

@EventHandler
public void onChat(@NonNull AsyncChatEvent event) {
  var prefix = getPrefix(event.getPlayer());
  var style = prefix.children().getLast().style();
  event.renderer(ChatRenderer.viewerUnaware((player, playerDisplayName, message) -> {
    return Component.textOfChildren(prefix, playerDisplayName.style(style), Component.text(" » ", NamedTextColor.DARK_GRAY), message);
  }));
}
#

I don't find it to be particularly clean but that's probably the only thing that's gonna work properly lol

#

I also don't know whether it'd be better to use mergeStyle or applyFallbackStyle

glossy bough
#

ima just try that

#

if that dont work

#

ima go sleep

#

its like 1 am already

#

it works

#

...

#

now i can go sleep gn

gray shuttle
#

<hover:show_item:diamond_helmet:1:{"minecraft:enchantments":{"minecraft:aqua_affinity":1}}> this mm tag doesn't work, am I wrong?

sand drift
#

You’d need to test but fairly sure that’s invalid

gray shuttle
#

yep it output just default diamond helmet

sand drift
#

Oh, the layout is correct, idk about the tag though,

gray shuttle
#

it's wrong maybe but I don't think it's wrong SNBT format afaik lol

boreal orchid
sterile rampart
#

not how component syntax works

#

guess we need to update the docs

gray shuttle
#

oh is docs outdated?

gray shuttle
#

then how should I use it?

boreal orchid
#

for what's worth, you can just serialize a component into MM to get what it'd look like, i.e.:

var item = ItemStack.of(Material.DIAMOND_SWORD);
item.addEnchantment(Enchantment.SHARPNESS, 5);
item.addEnchantment(Enchantment.LOOTING, 3);
MiniMessage.miniMessage().serialize(Component.text("Something").hoverEvent(item));
// returns <hover:show_item:diamond_sword:3:enchantments:'{"minecraft:looting":3,"minecraft:sharpness":5}'>Something
gray shuttle
#

ok I know now, thank you!

severe hollow
#

Hi - is there a non-deprecated version of player.sendTitle(); e.g. with components?

sterile star
severe hollow
#

Got it, thank you!

shadow wyvern
#

is there any (hacky works for me) adventure implementation for hytale?

#

and how complicated would it be to implement one myself

sand drift
#

Somebody at work tossed one together, not public though

#

I think somebody in this discord also tossed one togther too somewhere, you'd need to search

shadow wyvern
#

will do

#

I think I went through like 2k messages at this point I don't think there is

boreal orchid
#

is text in hytale even remotely similar to components in minecraft

#

they mostly use json for everything so I assume it is in some sense, though I am sure they have a different set of features for things like click and hover events

wet kestrel
#

Both using json just means they both can have properties 🤔

robust wharf
#

features? in hytale? lol

#

you cant even have colored name tags

#

but yeah, I do want an adapter for it eventually, its on my list

#

for MM

#

its #4 on my shit I wanna do list rn ^^

sand drift
#

i glanced at it and it looked like it was fairly componenty, and somebody at work said the same and said they could probably get adventure working for it

#

I thought somebody had posted one in a channel somewhere on here but, idk, discord search is useless and my memory is tragic

robust wharf
#

I did saw somebody using minimessage in hytale already, ye

#

you just need to translateadventures component class to hytales message class

sterile star
#

I mean, as long as they figure out a component serializer for whatever hytale uses, it works fine

robust wharf
#

and I think they only did color

shadow wyvern
#

I use a lot of TranslatableComponents, I wonder if those will be able to be used

#

might require to expose the Plugin/Server methods to give own logic to handle choosing Locale

boreal orchid
#

if you use translatable components for server-side translations, all it'd take is rendering the translations before converting it to hytale in the hytale component serializer

sweet hornet
# robust wharf you cant even have colored name tags

Maybe there's no way to actually get them in "vanilla", but when exploring the player data files we can see this:

"DisplayName": {
  "DisplayName": {
    "RawText": "indyteo",
    "Bold": null,
    "Italic": null,
    "Monospace": null,
    "Underline": null
  }
}

Which suggests that some styling is intented to be supported

robust wharf
#

well the packet doesnt allow it rn

#

its just a string

#

same with kick message

sweet hornet
#

I guess it's still work in progress then

#

Or maybe they tried with the display name then scraped the idea idk

#

Either way, considering the early state of all this, I wouldn't invest much time to this 😅

rare sage
#

people still need to remember that it's just an unfinished early access and the game has a lot of development ahead still

cloud topaz
#

Can someone give an example of using a sprite with adventure not minimessage? It's a new feature so it's hard to find any public plugins that do this

sterile star
#

That's the Adventure™ way of working with object components

cloud topaz
#

Thanks

#

How would I know the path of the item I want to use?

sterile rampart
#

those are drawn from whatever resource packs the client has

#

so for vanilla items you can look into the builtin resource pack

sweet hornet
raven tusk
sterile rampart
#

_ seems to be what vanilla uses these days

tardy mirage
#

Is it possible to use Adventure to set the name or lore of the Component type for an ItemStack while only introducing the Spigot dependency?

#

Or any another way?

tardy mirage
#

thx

tawny locust
#

@boreal orchid is Component.object a 21.11 thing?

#

working in .8 and don't see it in adventure

boreal orchid
#

it was introduced in 1.21.9 I think

tawny locust
#

aaaaaaaa

#

just trying to make a custom textured button 😭

grim bear
#

Hello, I'm working on a special anvil GUI that allows players to rename items using MiniMessage formatting codes. Currently I just deserialise the rename text and apply it to the resulting item, but I want there to be limits, i.e. I only want to allow colour codes, and some formatting codes, like <bold> and <italic>, but I don't want to allow things like <newline>. What would be the best way of doing this?

sweet hornet
#

Create your own MiniMessage instance with only the tag resolvers you want/need

grim bear
#

ty!

#

also, is there an equivalent to String#isBlank for components?

#

or would I need to serialise it to plain text and call isBlank on the resulting string?

sweet hornet
#

There's not, because some components are dynamic (score, NBT...) and cannot be determined whether they're blank or not. However, in your case, since you filter which components are allowed, you know you only have text components, so yeah either plain text serialize and check if the result isBlank, or traverse the tree yourself and cast each component to TextComponent, and check if the content isBlank

grim bear
#

the way I currently get my instance is simply with MiniMessage.miniMessage(). I can't immediately see other methods that allow me to specify tag resolvers or something

sand drift
#

MiniMessage.builder()

grim bear
#

Is there a way I can include a literal <red> tag (for example) in a string and have it not be parsed by MiniMessage? I'm writing an in-game book as a reference for MM tags that players can use

#

I plan on the book just being a string list in a yml file, and each line will be deserialised

sour totem
#

escape it with a \

grim bear
#

Is there a way I can have tag aliases in my MiniMessage instance? For example, I could have a <grad> tag that works exactly the same as <gradient>? I'm allowing MM tags to be parsed in a special anvil GUI, and the character limit of anvil GUIs is proving to be a problem, so I want to create shortened versions of all the tags I can if possible

boreal orchid
#

myMMBuilder.editTags(builder -> builder.tag("grad", (args, ctx) -> StandardTags.gradient().resolve("gradient", args, ctx))

grim bear
#

I'll give it a try thank you!