#adventure-help

1 messages · Page 2 of 1

cloud vapor
#

the goal of adventure is a platform-independent API that is used on multiple platforms that do not use any Minecraft code (e.g. minestom, velocity)

rare sage
#

that's what adventure is

fossil timber
rare sage
#

it is

#

they represent the minecraft component system

fossil timber
rare sage
#

you have a fundamental misunderstanding of not only minimessage but adventure

cloud vapor
rare sage
#

minimessage is just a serialization format, you can only use minimessage features in the context of minimessage serialization

rare sage
#

yes

fossil timber
rare sage
#

and?

rare sage
#

how is that false lmao

grand knoll
#

String representation -> component serialised to string lmao

cloud vapor
#

Not to be rude but can you read the whole sentence

and for developers to extend

#

to extend with custom tags lmao

fossil timber
cloud vapor
#

what

fossil timber
#

show.

#

me

#

how.

#

there is no documentation

fossil timber
#

but using Components

rare sage
#

again, you can only use minimessage features in a minimessage context

fossil timber
rare sage
#

minimessage does not exist outside of minimessage

cloud vapor
#

These are used during deserialization - you can add them to a custom MiniMessage instance or add them on the deserialize call e.g. deserialize("string", tags)

rare sage
#

adventure can exist without minimessage, you want to make use of minimessage features without minimessage

fossil timber
#

how?

fossil timber
rare sage
#

as stated earlier, currently serialization of custom tags is not public api

rare sage
#

once it is, you can use Virtual components to your heart's desire

cloud vapor
#

You can still use it tho, it's there just not public api

#

Go and look at any of the standard tags and just copy what they do

#

Gradient tags are an example of how you can do it with virtual components

fossil timber
cloud vapor
#

Can you chill on the sass a bit

fossil timber
#

I wonder how does a nuclear reactor works..

fossil timber
cloud vapor
#

Giving you examples is not a bad thing

fossil timber
#

okay, I'm exaggerating a bit, but it's a feature requested by many.

cloud vapor
#

it really isn't, i haven't seen a single person ask for it even before we added the internal api for it

fossil timber
#

I've also seen people try to duplicate minimessage tags, just because of using custom tags..

#

or placeholder api effectively

fossil timber
cloud vapor
#

I would def want to see some examples of that - please do share! Would be good to help us see what our final custom tag serialization api might look like

#

trust me devs are very good at asking for even impossible things lol

fossil timber
#

yes, thank you.

cloud vapor
#

Right but that isn't duplicating MiniMessage tags like you said

fossil timber
#

I said you're duplicating minecraft components, not tags

#

and your point was cross-platform support

#

which is fair.

rare sage
#

you said "I've also seen people try to duplicate minimessage tags"

#

whatever that means anyway

fossil timber
#

I'll give you an example

rare sage
#

and adventure "duplicates" minecraft components because you can use it outside of a minecraft environment altogether

cloud vapor
rare sage
#

adventure would be a whole lot less useful for a lot of people if it required a minecraft environment running for it to work

fossil timber
#

this guy did it before you guys

#

you love to see it.

rare sage
#

okay and?

cloud vapor
#

Right, but unless I'm missing something nothing there isn't possible on MiniMessage?

rare sage
#

also worth mentioning that minimessage has existed for far longer than it was integrated in adventure, or before adventure was even named adventure!

cloud vapor
#

In fact from what I'm seeing all it looks like is a clone of the format for use with BaseComponents (which, fwiw, just use the BungeeComponentSerializer from adventure-platform-something)

rare sage
#

you keep linking text files without an explanation of what your intention is

#

what about that file is impossible with minimessage?

fossil timber
#

which isn't public api

cloud vapor
#

What custom tags?

rare sage
#

oh boy

robust wharf
#

Fuck am old

rare sage
#

it used to serialize to bungee BaseComponents even!

#

and used regex 👻

fossil timber
robust wharf
#

Dark ages

rare sage
#

you can have a plugin-prefix tag

umbral wharf
#

someone needs to update it to use the new non array bungee components kekw

fossil timber
cloud vapor
#

But you could just do that with e.g. a static Placeholder.component("plugin-prefix", myPrefix)

cloud vapor
#

Stick it in some static custom MiniMessage instance and then you could literally just call deserialize("<plugin-prefix>My message")

fossil timber
rare sage
#

then what's the problem?

fossil timber
#

I have to use this instead of components.

#

I have to use String instead of Component.

rare sage
#

yes

#

again, if you want to use minimessage features, you have to use minimessage

#

you cannot use minimessage features outside minimessage

#

we're just going in circles; unless you have something useful to contribute to this conversation, I reckon this is over

fossil timber
# rare sage yes

them, when minimessage will replace its strings with components, for custom tags, everyone will use adventure.

#

that is my whole point.

cloud vapor
#

You can use custom styles in placeholders tho, just expand that to e.g. Placeholder.component("plugin-prefix", Component.text("MyPlugin", TextDecoration.BOLD)

#

Custom tags already support components

rare sage
#

again with the "everyone"

#

and your words are not making any sense

#

MiniMessage is a string format that represents components, in a string form

#

so if you wanna use minimessage strings you have to use strings

fossil timber
cloud vapor
#

You can use components in custom tags in deserialization and, using internal api, in serialization

#

None of the code you linked even touches serialization of custom tags so I'm not sure why you're complaining it's missing

fossil timber
#

I could use Gson insteaf of MiniMessage, and still won't be able to use components with custom-tags

rare sage
#

because json format does not have a concept of tags altogether

cloud vapor
#

Yes GSON doesn't support tags it's not intended as a user-facing format

rare sage
#

tags are a minimessage feature exclusively

#

custom tags specifically

#

you cannot use custom tags outside of minimessage because custom tags are a minimessage feature

#

the json format is defined by mojang, not adventure, so the json format adventure uses cannot have custom breadcrumbs

cloud vapor
#

Nor would you want to use them outside of MiniMessage because the entire point of parsing a string-based format is that you get access to the whole string for parsing, that isn't easy (or possible in some cases) with pure components

#

The string is tokenised and then converted into components - any tokenising step would just butcher the existing component tree if it used components as input instead of strings and wouldn't make any sense

fossil timber
#

yet it could have, custom tags, but not like anyone could imagine.

cloud vapor
#

Again it wouldn't make sense for it to have custom tags. Mixing two different text formats together is not a good idea and would be wildly complex for no real benefit

#

You'd have to tokenise a tree from inside another tree which is just wild

cloud vapor
#

Hm?

fossil timber
#

I'm thinking about TypeAdapters

cloud vapor
#

The JSON representation of components is a tree

#

I don't see how type adapters would help

fossil timber
cloud vapor
#

The point is that fundementally you're going from two intermingled trees into one tree which is leagues more complex than going from one tree to one tree

fossil timber
robust wharf
#

Pls stop calling people dummy or silly

cloud vapor
#

Yeah I've already warned you to chill with the sass don't make me go and learn how to use my newly gifted mod tools haha

fossil timber
#

and sorry if I really am

cloud vapor
#

But still, I'm not sure how thinking outside of the trees helps you actually get outside of them on a code level

fossil timber
#

so

#

TagResolver.Single

#

that is used in Placeholder class

#

could be serialised, right?

#

to json

cloud vapor
#

No - it's code and serializing code is bad

fossil timber
#

but the values being used

#

the placeholder

raw tusk
#

do you mean the result of resolving the tag?

#

that's just a component

fossil timber
#

you have Placeholder.parsed(key, placeholder)

raw tusk
#

that fits in the tree

fossil timber
cloud vapor
#

You can already serialize a component created by deserialzing some MiniMessage string into json

#

that's one of the nice things about components are that they become their own IR for stuff like that

kind jungle
#

Oh you mean you have a core set of multi-version and multi-platform modules that you use as templates for your projects?

plush ingot
#

Can I somehow send a Component message from player A to player B (private messages) that will be hidden for player B if player B has ignored player A in the ESC menu?

sweet hornet
#

I know yo can use identities but it looks like all methods related to this are deprecated

quaint monolith
#

Chat signing broke that, kind of

#

iirc it is still possible since /msg can still be signed but I'm not sure how to wire that up or if that's special treatment for that command

rare sage
#

that was around the time they were figuring that stuff out, those methods basically existed for, like, 2 versions

sweet hornet
#

Sad

cloud vapor
#

Yeah you'd need to just send a full signed message to the player

forest meteor
#

Using the API, how do i figure out if there is a set shadowcolor?

#

(assuming its not the default shadowcolor ofc)

forest meteor
#

also is there no ShadowColor#default() to do such check

sterile rampart
#

check that the shadow colour is non-null

#

null is the default value

forest meteor
#

oh okayy

#

tysm

vital sapphire
#

Ooh, minimessage translation support is out

#

It's tempting to switch from my custom messages.conf file to using the adventure stuff

cloud vapor
#

hold off for now - gonna add a translationregistry which should make it even easier to use

cloud vapor
#

you really should switch tho it's VERY cool even if i do say so myself

vital sapphire
#

My current method is a bit.. weird (at least to me) so I definitely do want to switch. Right now i just read in a hocon file of messages and then have a method with a TagResolver... parameter that converts the string to minimessage

#

only works with one language likent

cloud vapor
#

tbh working with one language is fine

#

i imagine 99% of devs that end up using this sytem will only use one language

#

but it just lets you do cool stuff like this without having to think twice

player.sendMessage(Component.translatable("my.key", Argument.component("name", player.displayName())));
vital sapphire
#

having it be cleaner and be able to use all the translatable stuff makes my life easier lol

cloud vapor
#

yeah i think the nicest part is letting people not have to worry about the hassle of it all

#

like any dev could now have a full translation system with just a few lines of code

noble sparrow
#

Do someone know why the showItem method with the HoverEvent in a chat message isn't showing my ItemMeta ? it's just an ItemStack with the basic ItemMeta.

cloud vapor
#

what is hand here?

noble sparrow
#

the ItemStack in the hand of the player

cloud vapor
#

and what software are you using? server version? client version? any protocol hack mods/plugins?

noble sparrow
#

paper 1.20.4, same for my clients, I don't have any strange clients or else

sweet hornet
noble sparrow
#

nah, I need to replace the "[i]" in the chat, not the whole message

cloud vapor
#

no indyteo is right, you should be doing that

#

1.20.4 paper is not supported unfortunately

upper tinselBOT
#
🚨 Unsupported Version

The version of Paper you are developing with is outdated and unsupported.

Old versions may not contain useful APIs to solve your problem and may have numerous bugs and/or exploits. If you wish to receive support, please ensure you are developing with the latest supported version.

noble sparrow
#

If I do this, the whole message will have an hover event on it

#

I need to have it on the "[i]" part of a message

sage river
cloud vapor
#

No, I suppose I could add something to wrap the target too

#

Can you open an issue?

sage river
sage river
cloud vapor
#

ill open an issue about the target tho dw

sage river
cloud vapor
#

translating into the correct locale is automatic

sage river
#

I'm not really sure how minimessage translator works yet, but do you mean that it's language/locale scoped or something?

cloud vapor
#

so you don't have to worry about what the players' locale is as that's handled automatically

sage river
#

ok, so basically I just need to provide the files with translations for locales to the minimessage translator and it would automatically get the correct string from the correct file?

cloud vapor
#

yep!

sage river
#

nice 🙂

vital sapphire
#

oh right, I just need to build my own registry

cloud vapor
#

I've got a PR open that should get merged soon that adds a way of handling that too

vital sapphire
#

I'll just.. borrow that code for now until it's merged :)
edit: oh i see which one it is. nvm

cloud vapor
#

so you can load it straight from a directory of .properties files

vital sapphire
#

I was considering looking into how moonshine works but it seemed like a lot of implementation was needed just for locale

sage river
#

what would be the best way to handle lists of components (e.g. for lores) while using minimessage translator?

cloud vapor
#

yeah moonshine is good if you love implementing interfaces

cloud vapor
sage river
#

how can I detect if there is no translation anymore?

cloud vapor
#

good question, ive opened an issue :p

quaint monolith
#

I did find some interesting alcoholic coffees though

sand drift
cloud vapor
vital sapphire
#

I love moonshine but I can't understand it SCsobbing

woven spade
hoary plume
#

Is there any way to apply color/formatting to the alternate text in lang_or?
MiniMessage components don't work and trying to use section codes results in the tag breaking...

cloud vapor
#

Fallback is just a string

#

Client limitation unfortunately

hoary plume
#

rip

cloud vapor
#

Best you could do is make your own lang_or that checks in the global translator

hoary plume
#

Not really worth it. A minor inconvenience, but nothing too problematic for me

woven spade
merry valve
#

From where do I get ComponentLogger, I tried to use adventure-api but it wasnt there.

merry valve
cloud vapor
#

text-logger-slf4j

sterile rampart
#

adventure-text-logger-slf4j

merry valve
#

thanks

noble sparrow
#

Can someone tell me why hand.displayName(), return an ItemStack with the default ItemMeta ? in paper 1.20.4

wet kestrel
#

That sounds like a paper issue rather than an adventure issue, but paper doesn't support 1.20.4 anymore.

noble sparrow
tawny bolt
#

not supporting means no help. Would highly recommend just updating

upper tinselBOT
#
🚨 Unsupported Version

The version of Paper you are developing with is outdated and unsupported.

Old versions may not contain useful APIs to solve your problem and may have numerous bugs and/or exploits. If you wish to receive support, please ensure you are developing with the latest supported version.

cloud vapor
#

^ as you've already been told

vital sapphire
#

What exactly is the benefit of the ComponentLogger vs the plugin Logger ?

tawny bolt
#

you can log colored text with it

vital sapphire
#

ooh

#

fair enough lol

merry valve
#

How do I get ComponentLogger in paper? I tried casting but that didnt work

rare sage
#

Plugin#getComponentLogger(), or just ComponentLogger.logger() or whatever the static method was

merry valve
sweet hornet
#

What will the component logger log when receiving a translatable component? The raw translation key (or the fallback if present)?

sand drift
#

afaik it runs through the flattener, so, it's going to depend on what translations are available on your platform

#

if no translations are available, it will be the key that's logged afaik

#

idk if it uses the fallback, I'd guess it does? MahiruShrug

sweet hornet
#

And would it be possible to feed him with Minecraft's translation file (like the en_us.json) so he can log values instead?

sand drift
#

You'd need to add stuff to the global translation registry, but, yes

#

that wouldn't be side-effect free, however

sweet hornet
#

Hmm

#

Sad

sand drift
#

i.e. you'd impact other plugins, etc

sweet hornet
#

It would be cool if the component logger was able to do it from its side, like a client (or an audience)

rare sage
#

on Paper it is set up to run through the server's translations too

cloud vapor
#

Definitely don't add the translations to the GlobalTranslator - that would mess with a lot of things

exotic wave
#

Hey there, does anyone have experience with the TextReplacementConfig? I've been trying for hours to get it to work, but it seems that it just won't.

                component = component.replaceText(TextReplacementConfig.builder()
                        .matchLiteral(placeholder)
                        .replacement(replacementComponent)
                        .build());

The component "replacementComponent" has a different color associated with it. The text is replaced correctly, but the color of "replacementComponent" is overriden

#

It seems like the .replacement only replaces the text and not the full component with its color

sweet hornet
#

It would make sense given the names .replaceText(...) / TextReplacement...

exotic wave
#

I agree, but I do also think that if it accepts a component it should actually replace it 1:1 and not only a fraction (text) of the component

cloud vapor
#

What are you trying to do? there might be a better solution

exotic wave
#

dang it :/
The messages of my plugin are stored in a seperate file and accept variables like "Player {0} joined word {1}". I've got two TextColors which represent the default and a highlight color (default = the whole text and highlight = {0} and {1}). I am trying to replace the {0} and {1} with the text AND highlight color

#

If that sentence makes any sense

sweet hornet
#

Maybe try translations

exotic wave
#

The text is replaced correctly but without the color formating, which, makes sense if it actually only replaces the text

#

huh?

sweet hornet
#

Are you using MiniMessage? Are you able/willing to use it?

exotic wave
#

I am using it yes

sweet hornet
#

I know there is built-in translation support in MiniMessage, so I guess you could try to use this system (with a single language, it's ok, but it'll handle your "placeholders")

#

I never used it myself tho

#

But Kezz will probably be able to help you more about this

exotic wave
#

good to know, but wouldn't that use something like i want to achieve with TextReplacement under the hood? So there should be something available?

sweet hornet
#

Idk, however if you want you can also define a custom tag like <highlight> that sets your highlight color

#

And perform the replacement in the raw text, before

cloud vapor
#

If you're using MiniMessage, use MiniMessage :p

#

It has an entire custom placeholder system and even in soon to be released snapshot builds it has an entire translation system with built in automatic placeholder support

cloud vapor
exotic wave
#

ahhhh

#

I'll give it a go, thanks for the help from both of ya

vital sapphire
#

MiniMessage ❤️

vivid bobcat
#

how can I set a default font globally

cloud vapor
#

You can't

#

You can ofc just replace the default font in a resource pack, which I assume you're using anyway

vivid bobcat
#

so

#

I'll put an internal <font></font>

#

font:minecraft for minecraft and font:default for resourcepack defaults?

cosmic loom
#

no

#

font:minecraft:default

#

it's a resource location with a namespace and path

vivid bobcat
#

font:default is setting my custom texture and font:minecraft or font:whatever goes to minecraft

rare sage
#

what

#

a font is a namespaced key, minecraft:default is the namespaced key of the default font, if you have a custom font you'd use my_namespace:cool_font

#

when using minimessage, you pass the whole namespaced key to the font tag, <font:minecraft:default> or <font:my_namespace:cool_font>

#

you can replace the default font in a resource pack, by putting it as the default font in the minecraft namespace, then that will just be the default font for everything

vivid bobcat
#

so probably if I don't specify namespace it will be minecraft

#

yes minecraft:default it setting my custom texture

#

minecraft:default and default set my custom txture, anything else set the minecraft default texture hahaha

cosmic loom
vital sapphire
#

awaiting the minimessage translation system HappyShark

cloud vapor
#

It'll come when it comes, we all work in our free time and taking time to review stuff is hard

#

Testing out the PRs and dropping a comment is always good !

last horizon
#

Could someone link to that pr
I am to blind to find it 😂

#

Nvm I think it is the translation store pr

cloud vapor
#

Should be the most recent 2 PRs from me

#

Both of the ones in the 4.20.0 milestone

sage river
#

why are CompoundBinaryTag#get*(key, defaultValue) methods notnull? using a null as defaultValue works according to the implementation

cold condor
#

using null as defaultValue seems to be against the specification

cloud vapor
#

Would you need the default values being nullable?

rare sage
#

that sounds like a bug then

cloud vapor
#

I'm not against making the param nullable and using @Contract for the nullability like we do in other areas

#

Just wanna make sure there's a good reason

rare sage
#

but making the param nullable implies making the return type nullable

sweet hornet
rare sage
#

you are still widening the return type

sweet hornet
#

I assume right now the default value is always not null?

#

Thus, adding the possibility of passing a nullable default value, that could lead to nullable return, only adds an eventuality. The return value will still be not null when the given default value will be

cloud vapor
#

The return type wouldn't widen for existing API users

rare sage
#

while not a binary incompatible change, api wise it's still widening, i can only imagine the 3 kotlin nbt users coming to complain their code no longer compiles after updating

sage river
# cloud vapor Just wanna make sure there's a good reason

I don't need it anymore, but I was writing an implementation of a maplike class with backing CompoundBinaryTag and it was just easier to simply do compoundTag.getString("key", null) instead of compoundTag.get("key") != null ? compoundTag.getString("key") : null when return value of my maplike's getString method is nullable

cloud vapor
#

Well the get method doesn't return null anyway so

cloud vapor
#

But I don't really think using CBT in for a map is a good idea

sage river
sage river
cloud vapor
#

Oh right that not getString

cloud vapor
#

They're used to breaking changes

#

just don't tell jroy i said that i have a reputation to uphold

vital sapphire
finite furnace
#

can anyone help me with showItem for hover event?

upper tinselBOT
#
Don't ask to ask.

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

finite furnace
#

how do i get Map<Key, ? extends DataComponentValue> dataComponents from items?

#

i got BinaryTagHolder but that doesn't display anything about item, display name, lore, etc

#

so i assume i need to get those data component values

#

i know about getData in ItemStack, but that returns Valued and not DataComponentValue

rare sage
#

if you're using paper you can just use ItemStack#asHoverEvent()

finite furnace
#

i.... did not see that

#

thank you

vivid bobcat
#

is there a way to do a simple if else with MiniMessage tags? example <<a_boolean>:<if_true_>:%else%>

vivid bobcat
#

ctx.getTagResolverList().add(Formatter.booleanChoice("self_profile", isSelfProfile()));

#

how the tag would be like? it will parse other tags?

cloud vapor
#

it will support tags yes

vivid bobcat
#

ok

hoary plume
#

Maybe unusual question, but what would be the format for a JSON component to have a text shadow color applied? The MC wiki seems to be outdated on this info.

sterile rampart
#

uhh I think the MC changelog was linked somewhere

#

maybe in the original shadow colour PR

hoary plume
#

nope

#

Found it. It's shadow_color.... who would've guessed.

cosmic loom
hoary plume
#

I'm getting a Component with a Block's Name by using Component.translatable(Block#translationKey())
My question now is, how I could obtain the actual text for a player? I want to calculate the text width returned, but I'm unsure what I would need to do here to achieve this with a translatable.

sweet hornet
#

You can't compute server-side something that is client-side

#

The actual string is defined by the user locale, and possibly the resource pack

sour quarry
#

I mean, the english (and only the english) default lang file is present in the server, so you can use the Translator (I forget the exact class name) to set it for english only, with all of those above caveats too

sweet hornet
#

The best you can do would be to take the English (or any other language, probably the one most of your users will use) translation files and compute the result, but yeah that won't be exact for all players

#

What is the final goal?

hoary plume
#

I just mentioned it

sweet hornet
#

(Why do you need the width?)

hoary plume
#

To apply specific amounts of characters that will display custom images based on a resource pack

foggy briar
#

Could someone explain what tag resolvers are?

cloud vapor
#

They are how you resolve custom tags in MiniMessage

foggy briar
cloud vapor
#

Yeah basically

foggy briar
#

ah okay thanks

balmy stream
#

any idea why this would convert a string like "§3" to "\<whatever_color>"?

torpid robin
balmy stream
#

ty

hoary plume
#

What's the easiest way to check if a component is Component.empty()?

sand drift
#

==

hoary plume
#

That's easier than I honestly expected...

#

Tho, if I now would apply a font to an empty component, would it still be considered empty?

cosmic loom
#

well it won't be the empty instance because it doesn't have an empty style

rare sage
#

^ it would no longer be Component.empty()

heavy cliff
#

Does the shadow component not work in chat? I tried displaying <!shadow>Test in the action bar- works great. But displaying it in chat shows "Test" with its shadow still there.

cloud vapor
#

Should work fine

cosmic loom
#

works fine for me

cloud vapor
#

What platform/version? Any protocol hacks e.g. via version?

#

Any custom clients or client modifications?

heavy cliff
#

Using 1.21.4 Paper (and client is on Fabric 1.21.4 with no mods installed). ViaVersion is installed, yes.

cloud vapor
#

try without via and on vanilla

heavy cliff
#

Oh wait, ViaVersion isn't installed on this server. I'll try changing to vanilla

#

Ah, it was the profanity filter I was using. I guess it's stripping the !shadow away but not color or other text format. Thanks for pointing me in the right direction!

robust wharf
#

Most likely used an outdated adventure version or worse, bungee chat stuff

#

Open an issue so they can fix

heavy cliff
#

Well actually the weird thing is, it's only using text.replaceText(builder -> builder.match(pattern).replacement(maskWord(word)))
text is a MiniMessage Component

cloud vapor
#

huh

#

tbh that might be an us bug

sterile star
#

Maybe they shade it?

#

So still outdated?

cloud vapor
#

if we aren't accounting for shadow in style merging and such? feels like a big oversight if true

heavy cliff
#

No, it's a plugin I made. I didn't shade it

sterile star
#

I see

robust wharf
#

Can you try to recreate a simple reproduction case and open an issue with that please? So somebody can take a look and this isn't lost

heavy cliff
#

Yeah

heavy cliff
#

I looked into it deeper and it's something wrong with packetevents, not MiniMessage.

robust wharf
#

Thanks for the update!

tepid fable
#

serializing ItemStack.asHoverEvent() creates a component with § colors inside that is impossible to deserialize again

#

how can i serialize asHoverEvent so that it is in correct minimessage format?

#

Thanks

wet kestrel
#

Can you show your code and a toString of the component you get from asHoverEvent as well as a /paper dumpitem for that same item?

tepid fable
#

sure

#

First is the console error the second is the dumpitem

    private Component getItemNameComponent(@NotNull ItemStack itemStack) {
        if (itemStack.getItemMeta() != null && itemNameProvider.hasItemName(itemStack.getItemMeta())) {
            return LegacyComponentSerializer.legacySection().deserialize(
                    replaceAmpersandCodesWithSection(itemNameProvider.getItemName(itemStack.getItemMeta())))
                    .hoverEvent(itemStack.asHoverEvent());
        }
        if (itemStack.getType().isAir()) {
            return Component.text(plugin.config.nothing_tag);
        }
        return Component.translatable(itemStack.getType().translationKey())
                .hoverEvent(itemStack.asHoverEvent());
    }

This is the method

mental vineBOT
mental vineBOT
sand drift
#

§f

#

something is doing a bad and using legacy colors inside of components

tepid fable
#

ok but it works. why does it work in normal minecraft and then it doesn't serialize correctly?

sand drift
#

Because the clients text renderer still has logic for parsing the legacy cruft

#

it's just unsupported by them and us

#

it has many dozens of side-effects and we generally just do not support it

#

I thought that that stuff would be escaped out and MM would just ignore it on the reverse, however

tepid fable
#

is there any way to translate those legacy into minimessage?

sand drift
#

Depends on the input, generalyl you'd go component > MM

wet kestrel
#

There's no reason to still be using legacy formatting in your code or configs in 2025. Time to migrate! 🙂

tepid fable
#

Got it thank you. i agree but many plugins are still outdated af

#

i hate MMOItems

#

it's such a bad plugin

remote marten
#

hey hi I'm having trouble with advanture api

<hover:show_text:“<gray>ѕᴏɴʀᴀᴋɪ ѕᴏʜʙᴇᴛᴇ ɢᴇçᴍᴇᴋ ɪçɪɴ ᴛıᴋʟᴀ”><click:run_command:/wlook command odulcu_ferhat_sifir><bold><gold>ѕᴏɴʀᴀᴋɪ"</click></hover>

I'm doing something like this, I normally work in 1.20.1, I changed the server version to 1.21.1 and only <gold> started to work, run_command does not work or I cannot click on it.

mental vineBOT
fiery oracle
#

are you using viaversion or some other protocol hack?
make sure you're testing with the same client & server version

vivid bobcat
#

Formatter.booleanChoice("test", value);

works: <test:A:B>
doesn't work: <test:<green>A:<gray>B>

please help

fiery oracle
#

you need to quote

#

i.e. <test:'<green>A':'<gray>B'>

vivid bobcat
#

thank you

steel cedar
#

how can I stop minimessage from escaping non-resolved tags when serializing to a string?

cloud vapor
#

You can't, that's just how it works in order to allow for proper round-trip serializing

#

Why do you not want non-resolved tags to be escaped? Sounds like a bit of an xy

steel cedar
#

so I have a method that takes a string and returns a component, basically a converter.
But the input string can contain §, & and minimessage text, and I want to convert all of them

cloud vapor
#

That's not something we support or recommend at all, it's unfriendly to users and hard to maintain a system that works like that. I'd recommend a one-time migration of your config/lang files/etc to use MiniMessage so you don't have to worry about it at all

steel cedar
#

and it's janky, but this is what I'm currently using

val converted = LegacyComponentSerializer.legacySection().deserialize(text)
val converted2 = LegacyComponentSerializer.legacyAmpersand().deserialize(LegacyComponentSerializer.legacyAmpersand().serialize(converted))
val back = MiniMessage.miniMessage().serialize(converted2)
MiniMessage.miniMessage().deserialize(back)
steel cedar
cloud vapor
#

The suggested temporary fix is a simple one-time migration

steel cedar
#

im currently doing that but I got a lot of stuff depending on this and I just want to see if it works

#

but thank you anyway

foggy briar
#

is it possible to get a raw String from a Component?

quaint monolith
#

What do you mean?

foggy briar
quaint monolith
#

There are three or more different strings you could get from a Component

#

plain text, JSON, minimessage, etc

foggy briar
#

plain text

half matrix
#

Do Component#color and Component#decoration modify the instance or do they only return a modified copy?
So would this code work?

Component component = Translation.component(this, key, variables)
if (color != null)
    component.color(color)
if (decoration != null)
    component.decorate(decoration);
return component;
sour quarry
#

Components are immutable, any method that "modifies" a component just returns a mutated copy

half matrix
#

alright, thank you

full onyx
#

Hello can someone explain my why Component#replaceText doesnt work for me?

Component prefix = gamePlayer.getSelectedPrefix().getPrefix().replaceText(TextReplacementConfig.builder().match("%user_name%").replacement(player.getName()).build());

Component prefix = MiniMessage.miniMessage().deserialize("gradient:#BAC06F:#E47AEB%user_name%</gradient>");
thats my prefix where i want to replace the %user_name% with the players name.

cloud vapor
#

Is there a reason you aren't using MiniMessage's tag system?

#

e.g. Component prefix = MiniMessage.miniMessage().deserialize("<gradient:#BAC06F:#E47AEB><user_name></gradient>", Placeholder.unparsed("user_name", player.getName()));

#

In fact the reason your code isn't working is because it would never work at all. When you make the MiniMessage string the %user_name% will be split and colored individually to apply the gradient - meaning you can't use the text replacement system because each character will be in its own component with its own color, and the text replacement system doesn't match across components. So you actually need to be using MiniMessage properly here in order for it to work 😅

full onyx
#

Ahh i see now it works thank you!

cloud vapor
#

np! 🫡

vital sapphire
#

will the minimessage translation system support having messages that use placeholders like <my_placeholder> instead of the {0} argument system used by the current internationalization system

cloud vapor
#

Yes

near valley
#

e.renderer(ChatRenderer.viewerUnaware((source, sourceDisplayName, message) -> Component.text().append(miniMessage().deserialize(prefix)).append(Component.text((plainText().serialize(sourceDisplayName)))).append(miniMessage().deserialize("<white>:<reset> ")).append(message).build()));
Why does this not color the username?

sour totem
#

because you're appending the display name to the empty component which has no styling

near valley
#

which has color in it

#

wait, does the color of a previous component not transfer to the next one?

sour totem
#

components only inherit styling from their parent

near valley
#

so how do I fix this?

sour totem
#

you can try appending the display name to the prefix component

near valley
#

do I really have to serialize the display name to minimsg, append the prefix in front of it and then deserialize it back to a component?

sour totem
#

no

#

you replace prefix)).append(display) with prefix).append(display)

near valley
#

huh

#

does that mean there is a difference between appending components directly and using the builder?

#

other than performance yk

cloud vapor
#

No, the issue is just what you're appending to

#

I would suggest using mini message entirely - it has a built-in custom tag system that allows you to easily add your own placeholders so you can avoid having to do all this appending

#

See this page and the dynamic replacements page for more information https://docs.advntr.dev/minimessage/api.html

mild oracle
#

hey, <!shadow> does not seem to work. It does not get parsed or anything, it stays as <!shadow>. I am on Fabric 1.21.1
Any idea why and how to fix or workaround?

cloud vapor
#

did shadow even exist in 1.21.1

cloud vapor
mild oracle
#

Ah, I see, any way to remove shadows from text in 1.21.1?

sweet hornet
#

Not in vanilla Minecraft

mild oracle
#

is there in modded? as I am running fabric

wet kestrel
#

And your fabric mods added shadows?

sweet hornet
#

I don't know about modded, hence why I said "vanilla"

mild oracle
#

no, I want to do some custom ranks, with fonts, and they double down with the shadow and look weird

#

hence I want to remove the shadow

sweet hornet
#

Why are you running in 1.21.1 and not latest?

mild oracle
#

cobblemon server

#

so I am stuck with whatever they are stuck on

wet kestrel
#

The reason I asked what I asked is because, as kezz said, shadows weren't added until 1.21.4. So, where are the shadows coming from, as it wouldn't be in a 'clean' fabric install.

sweet hornet
rare sage
#

shadows were always a thing, the ability to specify a custom shadow colour wasn't

mild oracle
sweet hornet
#

It's the option to customize (and therefore disable) them that was added

wet kestrel
#

The ability to toggle that shadow was always a thing? manythink

rare sage
#

no?

sweet hornet
#

No

#

Added in 1.21.4

wet kestrel
#

Okay, so the answer is "on 1.21.1 this cannot be disabled without some sort of mod shenanigans, and wouldn't be part of adventure"?

sweet hornet
#

That's it

mild oracle
#

lovely

#

how were custom rank tags been done in vanilla before 1.21.4 tho?

rare sage
#

with the default shadows

#

do you have an example of what kind of "rank tags" you have in mind?

mild oracle
#

ye

rare sage
#

i mean in game

sweet hornet
#

If you look closely, you'll see the shadow

rare sage
#

all servers I've seen using those kind of tags have always had the default shadows

mild oracle
mild oracle
#

maybe adding a ticker border would mask it somewhat

sweet hornet
#

Let's be honest, I don't even see the shadow as a problem on your screenshot

#

But that's a whole different conversation, and I don't want to question your design choices

mild oracle
#

yeah, I was alligning it so I was zooming it and checking per pixel

wet kestrel
#

pixel-perfection in such a low-graphics-quality game is a route to madness

mild oracle
#

this is a better representation of what I was looking at

mild oracle
#

anyways, thanks for the help guys

sweet hornet
#

We'll say it adds a little depth to your design 😂

cosmic loom
#

you can remove them using core shaders @mild oracle

mild oracle
cosmic loom
mild oracle
#

Alright that will be very useful, thanks

half panther
#

I notice that 1.21.4 paper that MiniMessage#deserialize(String) does not throw an IllegalArgument Ex if the String contains § Is this really the cause or are my exceptions bugged 😂

cloud vapor
mild oracle
cloud vapor
#

You're making the mixin, just put an if statement somewhere on the content or w/e

mild oracle
#

I did not manage to get that working as the render function was receiving the entire line of text and was computing the shadow for the entire line, and I wanted something like [no_shadow] [shadow} [no_shadow] {shadow]

tacit dome
#

Hello there
I wanted to ask few questions

1a) Since which Adventure/MiniMessage version shadow is supported
1b) Since which MC version shadow display thing for chat and message formatting will be seen by the client? 1.2?.? (and higher)
2b) What is matrix formatting called, i mean how to call it in MiniMessage, i tried [matrix] and [magic], both does not work

tacit dome
#

ok obfuscated

#

apologizes

vivid bobcat
#

hello mrs,
this works:
<friend_online_status_ordinal_choice:'0#OFFLINE|1#ONLINE|2#AFK'>
this doesn't:
<friend_online_status_ordinal_choice:'0#<red>OFFLINE|1#ONLINE|2#AFK'>

am I missing any quote?

cloud vapor
#

maybe you need to quote each choice as well?

#

like '0#"<red>"' ?

quaint monolith
#

Isn't it up to whatever added the friend_online_status_ordinal_choice tag whether or not MM tags get parsed in there?

cloud vapor
#

can't say im that familiar with the syntax for choice format, but probably consult the jd for it

vivid bobcat
#
<white>Status: <friend_online_status_ordinal_choice:'0#"O<red>FF"|1#ON|2#AFK'>
#

tagResolverList.add(Formatter.choice("friend_online_status_ordinal_choice", friend.getOnlineStatus().ordinal()));

cloud vapor
#

I'm not really sure what else to say at this point, you might have to consult the javadocs for choice format to see exactly what format the strings should be in

vivid bobcat
#

I'll take a look

#

on it

#

fixed it:

<white>Status: <friend_online_status_ordinal_choice:0#'<red>OFFLINE'|1#'<green>ONLINE'|2#'<gold>AFK'>
cloud vapor
#

nice spot!

tacit dome
#

Hello
so i did not use adventure since 4.14 (maybe it's even earlier version)
was it there ever net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer or not and if yes what happened with it?

sand drift
#

seperate module?

tacit dome
#

well i had adventure shaded into a plugin, and this was also there with few more bungeecord classes

sand drift
#

Yes

#

as part of a seperate module

tacit dome
#

Oh ok

#

btw, is adventure built into Velocity?

sand drift
#

yes

tacit dome
#

😮

#

that makes life much easier xd

tacit dome
sand drift
#

why would there be?

#

velocity already has native support for adventure and bundles in the defacto serialisers

#

there is no platform specific stuff that we'd need to deal with translating to, implementing our own text component representation would of been dum

tacit dome
#

ok so, how can i utilize this in a velocity plugin
I am new to velocity and to adventure to be honest

#

i don't see anywhere usage for velocity on docs.advntr.dev

sand drift
#

Because it's natively supported

#

velocity classes implement the Audience interface

#

so you'd just get the player and use the standard adventure methods

tacit dome
#

ok alright will come back here after i play around even if i don't know, thanks a lot for that infos

ocean agate
#

Just a question, isn't title duration based on ticks? Why Duration is needed here

cloud vapor
#

Depends on the platform

#

Not everthing operates on a tick being 1/20 of a second

sand drift
#

Duration is available everywhere, too

#

and is easy to convert into the platform requirements

cloud vapor
#

If you want "standard" ticks - see Ticks.duration

vivid bobcat
#
#this works:
lore=\
  <test1:\
  0#'\
    A\
    <test2:\
    0#'\
      A\
    '|1#'\
      B\
    '|2#'\
      C\
    '>\
  '|1#'\
    B\
  '|2#'\
    C\
  '|3#'\
    D\
  '>

#this works:
lore=\
  <test1:\
  0#'\
    <red>A</red>\
    <test2:\
    0#'\
      A\
    '|1#'\
      B\
    '|2#'\
      C\
    '>\
  '|1#'\
    B\
  '|2#'\
    C\
  '|3#'\
    D\
  '>

#this doesn't work:
lore=\
  <test1:\
  0#'\
    <red>A</red>\
    <test2:\
    0#'\
      <red>A</red>\
    '|1#'\
      B\
    '|2#'\
      C\
    '>\
  '|1#'\
    B\
  '|2#'\
    C\
  '|3#'\
    D\
  '>

do I need to escape any quote or tag when choice inside choice?

last horizon
#

seems to be correct but maybe put all of them into one line
thats even more confusing than online line

vivid bobcat
#
lore=<test1:0#'<red>A</red><test2:0#'<red>A</red>'|1#'B'|2#'C'>'|1#'B'|2#'C'|3#'D'>

the problem is in the quotes, but I have no idea how to fix that

sweet hornet
#

I guess you already tried \' or \\'?

vivid bobcat
#

yes \' and \\'

sweet hornet
#

And " or even maybe SQL-style ''?

vivid bobcat
#

" doens't work

#

yes already tried ''

paper escarp
#

Hey !

I'm having a little problem with my resolver tag. It works perfectly as long as there is no null management.
Here, val uuid = PlayerVoteData.getRank(place) the uuid is nullable. When the value is not null the resolver tag works perfectly but as soon as it is null, it stops and I don't even get the debug message println(‘DEBUG: Fetched UUID: $uuid’)
Is there a solution for managing nulls in a resolver tag?

private fun topLeaderboardPlaceTagResolver(): TagResolver {
        return TagResolver.resolver("vote_leaderboard") { args: ArgumentQueue, _: Context? ->
            val placeStr = args.popOr("Missing place id node").value()
            println("DEBUG: Parsing place: $placeStr")
            
            val place = placeStr.toIntOrNull()
            if (place == null) {
                println("DEBUG: Invalid place format")
                return@resolver Tag.inserting(Component.text("Invalid place"))
            }
            
            val uuid = PlayerVoteData.getRank(place)
            println("DEBUG: Fetched UUID: $uuid")
            
            if (uuid == null) {
                println("DEBUG: No player found at this rank")
                return@resolver Tag.inserting(Component.text("No Player"))
            }
            
            val username = PlayerDataManager.getUsername(uuid) ?: "Unknown"
            println("DEBUG: Resolved username: $username")
            
            Tag.inserting(Component.text(username))
        }
    }
cloud vapor
#

MiniMessage would not stop the execution of code if a variable was null. There's no way that debug line wouldn't be hitting. I'd suggest checking to see if you're swallowing any exceptions and/or stepping through with a debugger to see what's happening in more detail.

warped marsh
#

Hi!
I'm using Kyori's BossBars for the first time and, coming from the Bukkit version of BossBars, I noticed that there is no removeAll() method (at least it seems like it).
Am I missing something or does it actually not exist and the only way is to remove it individually for each user?

Thanks!

cloud vapor
rare sage
#

why doesn't Audience extend BBV anyway if it has show/hideBossBar & BB has add/removeViewer(Audience)?

cloud vapor
#

tbh i'm not sure why we have BBV in the first place

warped marsh
noble grove
#

Sorry if I'm in the wrong place, but I was just curious if anyone knew if the mini message tag <font> supports .ttf files?

#

Couldn't get my font to work with it but I may have just done it totally wrong

sterile rampart
#

it's just a reference to a resource pack font

noble grove
#

Gotcha, I'm guessing I just did something wrong somewhere lol, this just shows square icons <font:a.ttf>TEST</font>

sterile rampart
#

well what's the font named in the resource pack?

noble grove
#

a.ttf, I'm trying this out through ItemsAdder

sterile rampart
#

that's not how you add a font

#

look at the minecraft wiki for resource packs

noble grove
#

I see, so that's just how IA does it I guess

summer comet
#

Hi guys, why does this not work?

I used MiniMessage.miniMessage().deserialize, should i be using something else?

#

"<red>Hello World" works

sweet hornet
#

Specifically

summer comet
summer comet
#

Also what components are indeed shaded into paper? If i just want to support paper, what can i call in terms of MiniMessage?
I'm getting this:
"ClassNotFound net.kyori.adventure.platform.bukkit.BukkitAudiences"

robust wharf
#

If you just target paper, don't bother with platform-bukkit

#

Adventure and MiniMessage are included in paper, you can just call player.sendRichMessage("<rainbow>woohoo");

summer comet
#

Gotcha, is there any dependency i can use to get what you guys use for paper? (Assuming i don't need dpeendency to paper?)

summer comet
quaint monolith
#

1.17.1+

robust wharf
#

Idk when we added MiniMessage

#

Generally nobody uses those old versions anyways

#

So dw about it

cloud vapor
#

Since when did your name not have an e

robust wharf
#

Lol who was that

summer comet
#

So i'm currenrtly using this with no dependencies to know if Paper is active (with Adventure), do you guys recommend this?


        try {
            Class.forName("io.papermc.paper.adventure.PaperAdventure");

            return true;
        } catch (ClassNotFoundException e) {
            return false;
        }

Will this guarantee that there is a sendRichMessage?

cloud vapor
#

You would want to look for MiniMessage specifically

summer comet
#

This is a hook just for paper, not sure if i need anything else?

quaint monolith
#

Paper had adventure in 1.16 iirc but didn't get MM until 1.17.1

summer comet
#

Because sendRichMessage method is on paper, i just want a way to check if sendRichMessage without Checking via further reflection

robust wharf
quaint monolith
#

Although I think from 1.16 to 1.17 adventure had some API breaks anyway? At least the bits MM interfaces with did

summer comet
#

Yeah i understand, i'm just focusing on the method you mentioned, the sendRichMessage

quaint monolith
#

sendRichMessage depends on MM

summer comet
cloud vapor
#

You could just look for that specific method

summer comet
#

My questiton is if i can use that code i shared to make sure sendRichMessage is available

last horizon
#

i'd recommend using sendMessage with a component and doing the MM parsing yourself
that way you cover more versions

quaint monolith
#

No you cannot

#

That would return true on versions of Paper that don't have MiniMessage

summer comet
#

Thats what originated my original question

quaint monolith
last horizon
quaint monolith
#

Just stop caring about old stuff and you can just always use adventure and MM 😄

last horizon
#

for real

#

makes everything easy

summer comet
#

Not everything that is easy has the best outcome

robust wharf
#

There are less than 2000 servers on 1.16

summer comet
#

I'll use what you mentioned (the commandsender, thanks)

robust wharf
#

How high is the chance that they want to use your stuff? Lol

summer comet
quaint monolith
#

When did my nephew get turned in to a meme?

robust wharf
#

To compare, there are 100k servers on 1.21

last horizon
summer comet
#

I already mentioned above in other convs

#

Thanks anyway, what you mentioned will help me 🙂

summer comet
quaint monolith
#

That kid looks a lot like my nephew did 10 years ago

summer comet
#

😭

#

lmao

steel cedar
#

'quick' question; I have a lot of translations I want to convert to MiniMessage, so I'm using a development build of adventure (4.20.0-SNAPSHOT) to take advantage of the MiniMessage translation system.
Now there is an issue; I can't use a ResourceBundle to add all my translations to the MiniMessageTranslationStore, since it does not implement TranslationStore.StringBased. What's the recommended way of adding the all the translations to the MiniMessageTranslationStore? I haven't tried anything yet, and I want to make sure I'm doing it correctly beforehand.

cloud vapor
#

Good spot

#

Let me fix that for you

cloud vapor
rare sage
#

merge commits intjfall

steel cedar
cloud vapor
#

now why tf did that build fail

steel cedar
#

the previous build failed too

cloud vapor
#

it builds fine locally

#

what is that about

sterile rampart
#

kotlin

cloud vapor
#

let's yeet it now

sterile rampart
#

lol

cloud vapor
#

ok unfortunately i do not have time to fix the build today but ill check it out tomorrow for ya

steel cedar
#

that’s fine, thank you

sterile rampart
#

it's probably just changing the deprecation warning level

steel cedar
#

shouldn't the text be gray when using this method on a Component when using 2.20.0-SNAPSHOT?
my translation of command.gamemode.set.self is Your gamemode has been set to <gamemode> and I'm sending it with this code:

val arg = Argument.component("gamemode", text(to, YELLOW))

player.sendMessage(translatable("command.gamemode.set.self", GRAY, arg))

see the image for what I actually receive
nb. I've compiled paper with the dev version of adventure as well, which is the reason it 'works' in the first place

#

(of course with a MiniMessageTranslationStore)

steel cedar
#

is that intended behavior?

fiery oracle
#

i mean probably not? probably just missed

cloud vapor
#

hot damn another good spot

#

yeah it really should be applying the style from the component

cloud vapor
#

thank you for testing and playing with it btw! how are you finding the new api? still time for suggestions or improvements

steel cedar
#

so far (almost) everything seems to work as expected, and pretty intuitive as well. I haven't experimented a whole lot though, so I can't really give good suggestions or improvements

cloud vapor
#

Very nice, glad to hear that!

#

please do let me know if you've got any comments or issues at all tho! :D

steel cedar
#

will do

#

@cloud vapor I can't assign you, so someone else will have to do that

cloud vapor
#

Will do, ty!

foggy plume
#

Would it be possible to limit the number of characters in a component? Or alternatively process the component to remove any characters over my limit?

I am basically just trying to display an item's display name on a sign, I previously was just setting the line with a String and taking a substring and adding ... if the name went over the limit of 15. But when gradients and hex colours get involved that isn't really feasible anymore

cloud vapor
foggy plume
cloud vapor
#

It's effectively an iterator through a component tree that gives you access to pop/pushed style and plain text via the FlattenerListener that you implement

foggy plume
#

ohhh

cloud vapor
#

So you could use it to fetch the style and text of a component, stop after you hit 15 characters and break out

foggy plume
#

that's reasonable! thank you :)

ocean agate
#

can I use equals to compare two components if they have the same contents and decorations

cloud vapor
#

.equals yes

foggy plume
cloud vapor
#

yeah i think that looks good

foggy plume
#

Yeahh that worked great, thanks for the advice and support, it's greatly appreciated!

cloud vapor
#

🫡

#

tbh i wouldnt mind adding truncation to the api, feels like a nice thing to have

foggy plume
#

Yeahh I could see it being handy in other scenarios too

steel cedar
#

how can I make a TranslatableComponentRenderer render child TranslatableComponents when the top-level component is also a TranslatableComponent? This statement specifically makes that not work, so what's the correct way to do this?

#

^ pulled from TranslatableComponentRenderer.usingTranslationSource

#

XY: I'm trying to implement my own Translator so I don't have to use the GlobalTranslator so I can translate stuff when building ItemStacks for usage in inventory menus (and I saw people recommend usage of a separate Translator instead of the GlobalTranslator)

cloud vapor
#

It should be deeply rendering anyway

#

I wouldn't recommend implementing your own Translator anyway, use a TranslationStore - you don't have to register it to the global translator

steel cedar
#

oops, my bad I was confused. I am actually using the MiniMessageTranslationStore and using that to create a TranslatableComponentRenderer

#

should I not do that?

#

I was doing it this way since translate only takes a TranslatableComponent

cloud vapor
#

Actually I think you're right, it should be calling this.optionallyRenderChildrenAppendAndBuild on the resulting component

#

how have component translations ever worked lol

steel cedar
#

¯_(ツ)_/¯

cloud vapor
#

oh i see it's nested translatables that's the issue

steel cedar
#

yes

#

appending two translatables to a ComponentBuilder works fine

#

it's just that it doesn't work when the top-level component is a translatable

cloud vapor
#

I can get to that tomorrow unless you want to make a pr - we need to add proper component translation to the renderer

#

rather than the current system of overriding and calling super

steel cedar
cloud vapor
#

Not at all! I'm sorry these bugs all snuck through haha

#

We really should have better unit tests for that

delicate forge
#

adds the volkswagen dependency

cosmic loom
#

<@&748618676189528155>

bright remnantBOT
#

(67eae3f26ed5010734cf1c4c) // @severe gate (@danehcan / 1163918666409181235) has been banned by @green monolith (276788573666017280)
Reason: Steam scam

mental pollen
#

finally exit(1) when a § is encountered

delicate forge
#

unfortunately the legacy serializer will be sticking around for a while yet

#

even though we discourage using legacy in any projects, it's still very useful for converting from legacy to something like minimessage

dawn pewter
#

-# riley why no french nickname?

trail junco
#

Some projects that work from 1.8 to 1.21 heavily depend on adventure. For instance, Packetevents is the most used packet library and is compiled with java 8. Adventure 5.0 will def kill all old minecraft versions that were supported well

dawn pewter
#

tough times i guess.

#

are old versions required to run on older java versions?

trail junco
#

No but most servers won’t run java 21

delicate forge
dawn pewter
#

idk modern library and 11 years old version doesn't really match

past pulsar
#

Yeah

delicate forge
#

adventure 4.x won't be dropped instantly once 5.x comes around, either. we'll likely continue supporting it for a fair amount of time before it goes away

rare sage
#

Tip & Tail suffoClassic

wet kestrel
robust wharf
#

Using java 8 to run software is throwing free performance gains out of the window

#

And a security risk

sonic narwhal
#

Man i wish Adventure 5.0 was real and not some april fools joke

robust wharf
#

It is

#

The issue is older than the announcement

sonic narwhal
#

Oh shi

rigid temple
#

What’s adventure

karmic slate
#

a library for rich text representation

dawn pewter
mental pollen
#

is built-in in PaperMC, so you can use it's API right away

#

it also has mini message which allows you to use XML-like syntax for styling your text

summer comet
#

Hi guys, I'm getting this when trying to use sendRichMessage that might contain MiniMessage components as well as standard bukkit colors, how can I allow a message to be sent to the player that contains both Minimessage parsing and standard bukkit colors?

sand drift
#

standard bukkit colors

#

are literally not a thing

#

MM does not support using legacy colors, it breaks the entire concept of the tree and creates a whole bunch of headaches

#

best you can do is try to convert them, but, depends on where it's coming from, etc

cloud vapor
summer comet
cloud vapor
#

Yes

#

That's why we say migration

summer comet
#

Is there anything currently right now that allows me to support both MM and bukkit colors? (both at the same time, even if there is a parser in middle, it doesnt really matter)

sand drift
#

No

#

that will break the tree

#

I mean, if you want to do a blind find and replace, go for it

#

Just expect inconsistent output and 0 support

summer comet
#

Alr thx 🙂

cloud vapor
#

It "supports" any Minecraft version

tough peak
#

is there a way to add a dynamic placeholders (with player support)? So it would be updated automatically instead of setting it every time as an update

sweet hornet
#

Create a tag resolver

#

Example:

this.miniMessage = MiniMessage.builder().editTags(t -> t
        .tag("random", (args, context) -> {
            Component c = Math.random() < 0.5 ? Component.text("Yes!") : Component.text("No :(");
            return Tag.selfClosingInserting(c);
        })
).build();
vital sapphire
#

MM ♥️

hardy crest
sweet hornet
#

Hmm, I'm no sure what you mean by "the player"?

#

A (mini)message can be deserialized in any context, even where there's no player

#

I know there's a concept of "pointered" that can be passed in the .deserialize method, but I never played with it so I don't really know more

plain glade
tough peak
#

if a player is at X and he moves to Y, the text will update (from X to Y)

sweet hornet
#

Can you explain a little bit more what are you trying to achieve? This looks a bit like an XY problem (no pun intended)

tough peak
#

kinda like how you can update it manually, I am asking if there is a built in option

cloud vapor
#

Minecraft has no mechanism for automatically updating any form of text

#

You'll have to do that yourself

rare sage
#

you listen to the move event and change the text, action bar, scoreboard, tab list header/footer, wherever

sweet hornet
#

What "text" are you talking about? Actionbar? Bossbar? Scoreboard entry? Either way, as Kezz said, you have to run the update logic manually (every tick or second, on specific event such as PlayerMoveEvent...) in order to recompute the value

tough peak
#

Is there a way to add a list of tag resolvers?

#

or something like that

#

ok got it

#

TagResolver.resolver()

#

and I add to it the others, right?

cloud vapor
#

TagResolver.resolver(resolver1, resolver2, etc)

tough peak
#
List<TagResolver> a = new ArrayList<>();
TagResolver.resolver(a);

nice

cloud vapor
#

or use the deserialize method that accepts a varargs of resolvers

tough peak
#
TagResolver fineBlockPosResolver = TagResolver.resolver(
                TagResolver.resolver("block_x", Tag.selfClosingInserting(Component.text(player.getLocation().getBlockX()))),
                TagResolver.resolver("block_y", Tag.selfClosingInserting(Component.text(player.getLocation().getBlockY()))),
                TagResolver.resolver("block_z", Tag.selfClosingInserting(Component.text(player.getLocation().getBlockZ())))
        );

Is this ok or there's a better way?
-# P.S - Why am I the only one asking questions?? 😭

#
TagResolver fineBlockPosResolver = TagResolver.builder()
        .tag("block_x", Tag.selfClosingInserting(Component.text(player.getLocation().getBlockX())))
        .tag("block_y", Tag.selfClosingInserting(Component.text(player.getLocation().getBlockY())))
        .tag("block_z", Tag.selfClosingInserting(Component.text(player.getLocation().getBlockZ())))
        .build();

hmm

cloud vapor
#

either is fine tbh

#

Placeholder.component makes a tag resolver for you a bit simpler

#

same end result though

livid vigil
#

Sorry if this is the wrong place to ask. I'm interested in using the MiniMessageTranslator which was added in 4.20. I was wondering if there's a timeline for that version's official release, and if it aligns with Paper 1.21.5, would the bundled version be bumped to 4.20, or is 4.18 (as per "1.21.5-no-moonrise-SNAPSHOT") the decided version for the 1.21.5 release?

last horizon
#

how do i use a boolean choices
the docs only touch number choices

#

i tried <value:'enabled','disabled'>
<value:'enabled|disabled'>
<value:'true#enabled|false#disabled'>

#

figured it out <value:'enabled':'disabled'>

robust wharf
#

That doesn't exist tho

#

Generally we bump adventure whenever possible

proven otter
#

how would i dynamicly replace the text of lore? i have a system for custom items and it needs dynamicly updating lore based on nbt(Item Components), time of day(day/night), etc.
i'm defining the lore in MiniMessage format

robust wharf
#

Use placeolders and reparse the MiniMessage

proven otter
cloud vapor
#

Feels less performant or you know it's less performant?

#

Don't prematurely optimise

proven otter
#

true! thank you!

sterile star
#

I just wanna very quickly verify this. There is no sane way to create the equivalent of a <gradient> tag with the API, right? I am like 99% sure of that, but I am asking for the remaining 1%. (So explicitely without the usage of MiniMessage)

#

I am not asking for myself — I would personally just use MiniMessage — but I am asking out of curiosity

sand drift
#

I mean, depends on your input/output

#

like, replaceText lets you return some component, you'd just need to deal with generating the gradient components yourself

sterile star
#

Let's say I have a String: This is very nice looking text.

I want that to turn into a gradiented Component, which is the equivalent of if I were to serialize ```xml
<b>gradient:light_purple:aqua:light_purpleThis is very nice looking text


Just to specifiy it a bit further
sterile star
sand drift
#

I mean, I would probably be grabbing code from adventure to emulate that, but, tags are handled purely in their own space in MM

#

anything else would require you to deal with that component creation yourself

sterile star
#

And that's more effort than it is worth lmao

arctic dirge
#

How can I use MiniMessage in a component, and simultaneously use PlaceholderAPI.setPlaceholders, which in most cases includes legacy ampersand color codes, and still render those color codes correctly?

I know you can parse them into a component, using LegacyComponentSerializer.legacyAmpersand(), but say I had this

var ampersand = LegacyComponentSerializer.legacyAmpersand();
var mini = MiniMessage.miniMessage();

String format = "<b><blue>%vault_prefix% EXAMPLE</blue></b>"

// how to correctly parse `format` string with both?
sand drift
#

best you could do is abuse replaceText and call into PAPI there and do the translation

sterile star
#

I believe that's also somewhere in the adventure docs as an example?

arctic dirge
#

PAPI is not returning them using the section symbol (§) either, it returns them with an ampersand (&)

sand drift
#

then use the legacyAmpersand serialiser

#

idk if that's consistent however, might want to try to deal with both

arctic dirge
#

works fine

arctic dirge
sterile star
#

PAPI itself has no concept of colored text - the plugins providing the implementation of the placeholder just return a String. Whether they use an ampersand or a section symbol has no meaning to PAPI

arctic dirge
#

in my case, vault_prefix placeholder contains ampersands.

sterile star
#

I would probably just convert all section symbols to ampersands and use the ampersands legacy serializer

sterile star
arctic dirge
#

older versions of PAPI used to parse ampersands using ChatColor.translateAlternateColorCodes method, so it consistenly returned strings containing section symbols, as far as I read so far

#

and then they decided it was out of the scope of PAPI to handle color, which is valid

sterile star
#

Yeah, checks out

arctic dirge
#

so the color doesnt spill, which makes it not function correctly in the context of a vault prefix in my use case

#

where the prefix would be, eg
&cAdmin

#

and the intention is that you join player name, and the player name is red

sand drift
#

Yea, spilling has long been dead

#

tags can have placeholder args though, I think?

#

at least, I think that there was a preproccess type tag

arctic dirge
#

well, maybe i just make it possible to put text directly into the placeholder before processing

#

for my use case

#

can tag arguments be empty?

#

ah actually no need for that question, as I can just peek them, and ignore if missing
EDIT - this works for me 👍 thank you guys for the help

hoary plume
#

I feel kinda blind right now, but wasn't there a tag in Minimessage to not have tags be formatted? Iirc sometheing called <pre>?

#

Because I can't find any entry in the format docs

midnight spire
#

don't see it in the source but maybe it's not a normal tag

hoary plume
#

rip

cloud vapor
hoary plume
#

Not really.

#

Just want to display a tag as-is.

#

The \\ is enough for that

cloud vapor
#

Ah yes that'll do it too! We had to get rid of the pre tag because people were just using it completely for user input

#

Obviously the users could just </pre> and that was that lmao

steel cedar
#

when is the new version going to be bundled with paper?

upper tinselBOT
#
__There Is No ETA__

Updates to Paper do not have any sort of estimate for when they release, ever. Any and all updates will arrive when they are ready, and the only thing to do is wait for them patiently along with everyone else.

steel cedar
#

it was more so a question of whether it was going to be with the 1.21.5 release, but I understand

amber quail
#

What am I doing wrong?

config

  reload: |
    <gray> </gray>
    <green><bold>RELOAD<reset>
    <gray> </gray>
    <gray>Reload the <green>config.yml<gray> file to apply changes.
    <gray> </gray>
    <green><bold>RELOAD CONFIG:<gold><reset>
    <green>→ <underlined>Have a nice day!<reset>

https://pastebin.com/JVsm2YU1
Main class

Reloadcommand class
https://pastebin.com/Qqaz7hgf

When executing the command in console i see the text but when executing it in-game I see nothing.

sterile rampart
amber quail
#

Im not using legacy right?

#

Or am I missing out on something new?

sterile rampart
#

BukkitAudiences is only for spigot/bukkit/other legacy servers

#

did you read the docs?

amber quail
#

Ahh yeah now I get why it does not work 😂

#

Thanks thats enough information for me

#

Im using a paper server so should not be using the bukkit one at all

amber quail
#

Works great now

#

XD

arctic dirge
#

How can I check if a Component is empty (or just contains spaces?)

fiery oracle
arctic dirge
#

I will test. I think in my case the number of whitespace characters is predictable

#

It is either empty or contains one space

#

So thats enough I guess

#

I can just use java .equals?

fiery oracle
#

er
what exactly are you trying to do?

arctic dirge
#

vault_prefix, empty = default rank

#

if (rank.equals(empty()) || rank.equals(space())) check is enough

wet kestrel
#

Isn't vault prefix a string

arctic dirge
#

so i can embed the vault prefix into minimessage text

full onyx
#

Hi, I have been looking at the adventure Github repository and I have seen that the api module is the one that developers use in our paper plugins. My question is why are there so many modules in the project? For example the text module I understand that they are the implementations of the classes that are in the API. What exactly are those implementations for and I have also seen that there are implementations in the API module. If someone can explain it to me?

sterile rampart
#

there's no text module?

full onyx
sterile rampart
#

it splits up dependencies, parts of the project some people might not need, and parts of the project that might only be useful for people implementing serializers

full onyx
#

okey so you make it in parts to just use/add the ones you need

dawn pewter
#

<@&748618676189528155>

proven otter
#

how would i set lore text to white by default? i've remove the italic using .decorationIfAbsent(TextDecoration.ITALIC, TextDecoration.State.FALSE)

sweet hornet
#

.colorIfAbsent(NamedTextColor.WHITE)

proven otter
#

tyyy

umbral wharf
cloud vapor
sweet hornet
#

The ()

umbral wharf
#

^^

sweet hornet
#
-public class MyMiniMessageTranslator extends MiniMessageTranslator() {
+public class MyMiniMessageTranslator extends MiniMessageTranslator {
cloud vapor
#

ohhh

#

kotlin brainrot

sand drift
#

Kotlin, not even once

cloud vapor
#

nice spot, fixed it - thanks!

woven sphinx
#

Hello, I have a question.

I want to create a custom TagResolver#resolver that is closeable and applies the <gradient> effect.

The values for said gradient are hardcoded in my code, they are not available in the argumentqueue.

I have tried and tried but I can not accomplish it. The furthest I achieved was using a Tag.preProcessParsed("<gradient:colorone:colortwo>") but it is self-closing and I don't want that.

How can I do it?

quaint monolith
#

That looks like a special component that you can't replicate with the API so... nope

#

I guess find/replace the text before you pass it to MM?

cloud vapor
wind latch
cloud vapor
#

is that chatgpt code

#

please don't use chatgpt for support

steel cedar
#

Is it possible to override the locale used for a player (or audience) in the GlobalTranslator? If so, how should I do that? I'd prefer to not have to call render every single time I want something translated to a specific locale

robust wharf
#

Why do you not want to respect the locale choice of the player?

steel cedar
#

I will, I just want to be able to add an override if a player wants to have a different 'server' language than their client language for my plugin

cloud vapor
#

Not possible unfortunately no

steel cedar
#

alr, sadge

tough peak
#

is it possible to scale a component's text? or do I need to rely on fonts?

cloud vapor
#

not possible in vanilla - you'd need fonts or shader fuckery

sweet hornet
#

Tho, the aprils fool snapshot and the dev note on the latest snapshot saying they were working on GUIs, we might get something like that in a (near) future

#

At least I hope so

tough peak
sweet hornet
brittle robin
#
private void actionbarTask() {

        String value = Config.getConfig().getString("Editor.message", "null");
        Long time = Config.getConfig().getLong("Editor.time", 20L);

        if (value.equals("null")) return;

        Bukkit.getScheduler().runTaskTimer(this, () -> {
            for (Player player : Bukkit.getOnlinePlayers()) {
                String parsedText = PlaceholderAPI.setPlaceholders(player, value);

                player.sendActionBar(MiniMessage.miniMessage().deserialize(parsedText, Tags.getStandard(), Tags.getGradient()));

            }
        }, 0L, time);
    }
message: "<gradient:<gprimary>:<gsecondary>>Quest points:</gradient> <ascent>%notquests_player_questpoints%"

I have a question about custom fonts / images. We have in the texturepack (ItemsAdder) an image example19.png. If you write in chat :example19: it will render you an emoji, cool. If you do the same in Deluxe Menus it will also render emoji.

The question is how can I do that with Adventure?

regal quarry
#

How can I use dynamic replacements alongside arguments?

I have this input: <amount> <choice:'0#votes|1#vote|1<votes'>

but MiniMessage#deserialize doesn't have a way to parse the arguments:

kotlin
val arguments = args.map { Argument.component(it.first, it.second) }.toTypedArray()
        val parsedChoice = MiniMessage.miniMessage().deserialize(lang.rawTranslation(key), Formatter.choice("choice", choiceInt))
        // arguments aren't used```
sweet hornet
#

I remember now why I don't like Kotlin, it's unreadable outside of the IDE 😦 val makes everything harder, needing to guess the types

cloud vapor
cloud vapor
regal quarry
#

Oh I see
The example on the site made me think it required using this method 😅 thanks

cloud vapor
#

The example is specifically for the translation system

gritty tundra
#

I'm shading a few adventure libs into my plugin but I get this error when it runs on paper (no error on spigot):

Caused by: java.lang.IllegalStateException: Key adventure:json/emit/rgb has already been used. Option keys must be unique within a schema.

I'm using these deps. Last time I did plugin dev this wasn't a prob and I'm fairly sure kyori was native in paper by then, so I'm not what's up

net.kyori:adventure-api:4.19.0
net.kyori:adventure-platform-api:4.3.4
net.kyori:adventure-platform-bukkit:4.1.2
net.kyori:adventure-serializer-configurate4:4.19.0
net.kyori:adventure-text-minimessage:4.11.0
net.kyori:adventure-text-serializer-plain:4.11.0
net.kyori.moonshine:moonshine-core:2.0.4
net.kyori.moonshine:moonshine-standard:2.0.4
sterile rampart
#

you're not relocating everything, look at your jar

gritty tundra
#

you are correct, looks like net.kyori.option is not relocated. I never had that one configured. I will test but no doubt that'll fix this

sweet hornet
#

I guess you'll have to quote the argument, like <font:'myfont:custom_font'>text</font>

brittle robin
#

<font:menuicons>quest_overlay19</font>

#

hm

sweet hornet
#

I don't know how ItemsAdder works but you need to find in the resource pack created the name of the font and the text to place

brittle robin
#

give me a moment

#

that's the resource pack

#

the points it that if I write it down on chat it works

#

:quest_hard:

sweet hornet
#

Search in the resourcepack/menuicons/font/ (not resourcepack/menuicons/textures/font/) folder, it should contain a .json file with the font definition

#

To find out what text to write inside <font:'menuicons:quest_overlay19'>???</font>

brittle robin
#

there isn't any only yml file

info:
  namespace: menuicons
font_images:
  quest_hard:
    show_in_gui: true
    path: font/quest_hard.png
    scale_ratio: 9
    y_position: 8
  quests_overlay19:
    show_in_gui: true
    path: font/quests_overlay19.png
    scale_rotation: 256
    y_position: 13
sweet hornet
#

Then this is not the final resource pack, this is something the plugin is using to generate the pack. And I don't know how the plugin works so I can't help you more if you don't find the final resource pack generated and sent to clients

brittle robin
#

yea ok wait i will look at the outcome

#

mhm

#

no idea

#

OH

#

I DID IT

#

so the Placeholder API do it for you

message: "<gradient:<gprimary>:<gsecondary>>Quest points:</gradient> <ascent>%notquests_player_questpoints% %img_quest_hard%"

You need to add img_ before the name of texture

prisma mason
#

Hey one question about translations. I am wondering how to add support for localization on my Paper 1.21.4 server. I already have tons of Components created via Component#text or MiniMessage#deserialize. From what I've read GlobalTranslator is the way to go

#

I am asking because the components I send to players don't get translated automatically at least to my native language they don't

cloud vapor
#
#

That's our "official" way of easily handling both component and minimessage translations

#

Note that you need to provide the translations via that system, neither adventure, the server nor the client handle any sort of "automatic" translation

prisma mason
#

I've done a bit of reading on these, but it says all components are automatically sent to the GlobalTranslator, yet when I switch to my native locale it doesnt translate

#

That vexes me

cloud vapor
#

I mean, the client isn't exactly gonna ship an entire system to automatically translate arbitrary text unfortunately

prisma mason
#

hmm okay, so there isn't a way to translate my components easily?

cloud vapor
#

You make the lang files, we provide systems to load them and automatically handle creating component in the languages you provide to players

prisma mason
#

so in reality, translating longer text is not a viable option. But for example adding translations for some items (I have a ton of custom items) is viable?

cloud vapor
#

It's as viable as you want it to be

sand drift
#

items don't support server sided translations because that would require modifying the itemstacks themselves, and would bung creative mode