#adventure-help

1 messages · Page 13 of 1

wispy wagon
#

I'm using a MiniMessageTranslator and have a component like this:

{"translate":"cafegadgets.title.name.format","with":[{"translate":"cafegadgets.title.fiesta_fanatic"}]}

when I use the global translator on this component, only the parent gets translated

#

why is that?

#

looking at the code, it only seems to check for virtual components. Everything else is ignored, what a bummer

#

seems like I gotta make my own MiniMessageTranslator

wispy wagon
wet kestrel
#

Hi @gray tundra do you have a question about using adventure?

acoustic sequoia
#

I need something to help me

#

When I go to sa specific location or I rtp and when I log out I just go back to sever spawn

sterile rampart
#

you seem to be lost, no idea how that's related to adventure

acoustic sequoia
#

But does anyone know how to fix it?

sweet hornet
#

Obviously no, we can't help you about something specific to a server like this. You need to get in touch with the support of the server you're playing on. Here it is a tech support dedicated to the "adventure" Java library

uneven raven
#

Hello, if I use MiniMessage to deserialize text, does that not support click or hover events?
For example I do this

Component test = MiniMessage.miniMessage().deserialize("<hover:show_text:'<red>test test'>TEST</hover>");
// public BukkitAudiences adventure;
adventure.player(player).sendMessage(test);

I receive the text but there's no hover text. The same if I try click links

sterile rampart
#

MM supports hover events just fine

#

the legacy bukkit platform might have issues -- you don't need that when building a plugin for Paper servers

uneven raven
#

yeah I included MiniMessage so it works on non paper servers as well

#

any idea why it's not working tho?

sterile rampart
uneven raven
#

also it's shouldn't be using legacy, I included the latest versions

        <dependency>
            <groupId>net.kyori</groupId>
            <artifactId>adventure-text-minimessage</artifactId>
            <version>4.26.1</version>
            <scope>compile</scope>
        </dependency>```
sterile rampart
#

BukkitAudiences

#

that's legacy

#

Our recommendation for projects in the Bukkit ecosystem is to only support Paper servers, they're like 90+% of users anyways

uneven raven
#

looking thru the docs now but do you know offhand the non-legacy version of BukkitAudiences?

sterile rampart
#

Paper

#

adventure-platform-bukkit is a legacy library, it's only getting community support at this point

uneven raven
#

ok got it

#

sure enough using built-in paper's minimessage makes it work

raven crag
#

OfflinePlayer implements PlayerHeadObjectContents.SkinSource but it doesn't actually work for ObjectComponents if the player is offline. It just renders as a steve/alex head. Is there some simple workaround to get the client to resolve the player's skin, or should I just cache the ProfileProperty texture (or whatever it's called) in a database?

boreal orchid
#

until that PR is merged, you should just manually build a resolvable profile to the offline player's name OR uuid for it to work properly

lucid vine
#

Is there a way to implement animated components seamlessly

#

I looked at virtual components but couldn't figure out how they work

#

Something for a sidebar or action bar, that ticks every 50ms

cosmic loom
#

just send a new component every tick?

alpine marlin
#

Hey, I saw these tags/badges in the server list. (So without resource packs)
Now I wonder with which type of component is this possible? I thought about heads, but I guess that would be a bit inconvenient for texts.

sweet hornet
#

If you don't have any resource pack to have a custom font, then yes custom heads are the only option left. But Mojang removed this in the latest snapshots for the upcoming update

alpine marlin
#

So are those servers currently using heads for this to display and it'll break next version?

sweet hornet
#

Probably yes

#

If you have their IP, you can actually check by yourself

wet kestrel
#

Yes and yes. Which sadly makes it probably not worth it because folks won't be seeing it if running latest MC in a few days

sweet hornet
#

(of course you have their IP, it was poorly worded my bad)

alpine marlin
#

Alright, thanks for this information.
Just looked in 26.1-rc2 myself and sadly its breaking.

frozen tree
#

Is there any confirmed release date for adventure 5.0? Is it planned for paper 26.1 or will it still support 4.x?

spare silo
#

hello, i want to report a bug.

Minimessage is not able to replace a date tag inside hover events.

<hover:show_text:'<yellow>\uD83D\uDC65</yellow> Genutzt: <gray><uses>/<max_uses></gray>" + "<newline><yellow>⌛</yellow> Läuft ab: <gray><expires:dd.MM.yyyy HH:mm></gray>'><code></hover>

<expires:'dd.MM.yyyy HH:mm'> the mm (Minutes) are not parsed

I think it has something to do with:

cunning folio
#

hey how do i fix that the message is not deserialized?

it just sends the raw json code in chat

#

i use sender.sendMessage(mm.deserialize(...))

wet kestrel
sterile rampart
#

what is your input?

cunning folio
wet kestrel
cunning folio
wet kestrel
#

oh, also, you said json code, not minimessag code? Is that correct? You fed the minimessage deserializer json?

cunning folio
#

that plugin uses legacy colors originally, and i switched to minimessage

cunning folio
#

it sends raw json component in chat

wet kestrel
#

Throw in a print to log of the same message (result of formatMessage) I guess

#

though what's a formatmessage method doing feeding into minimessage deserialize?

cunning folio
wet kestrel
#

You know minimessage has a whole placeholdering system that users are already familiar with, right?

cunning folio
#

i havent used it lol

cunning folio
#

ill send what happened

wet kestrel
cunning folio
#

its tpa plugin, no logging needed

wet kestrel
#

Is that your input? That's not minimessage. That's a class being toString'ed.

#

As for not adding logging, I explicitly said to do so for testing. But since you're now showing this output, that's informative. You're toStringing it.

cunning folio
#

hmm

wet kestrel
cunning folio
#

I forgot to tell lol

#

string + component breaks it

rare sage
#

well, yes, +ing with Strings will implicitly call toString on the other object, and Component#toString() produces an info debug output yes

cunning folio
#

exactly

wispy folio
#

does adventure have some Gson helpers to easily dump data in chat?

#

e.g. something to make this easier on the eyes (my /dumpitem command)

boreal orchid
#

/paper dumpitem

#

that said, I don't think it is much different to that output

copper oriole
#

Is there a way I could use § just as a character or escape it somehow without it saying its legacy formatting

prisma mason
copper oriole
#

so §3 means Section 3

prisma mason
#

I see

#

Well you could alternatively make a placeholder instead of this symbol and then use replaceText method on the component

#

Or just use your own tag

sour totem
#

there's a chance the client might still interpret that as a color code, even inside of a component

prisma mason
#

Its worth a shot

boreal orchid
#

does this happen in your test server? Because jmp's run-task gradle plugin enables that warning for its runServer task

sweet hornet
#

No I don't think it's off by default

#

From my experience it is on

#

But I haven't checked the code in ages

#

(Unless you said in is not the case but that it should be changed to be the case, then idk)

sand drift
#

MM has its own thing which can't be disabled

#

then there is a standard component warning thing for malformed legacy usage

boreal orchid
#

why does MM even have its own thing given that adventure has a warning at the component level anyway

sweet hornet
#

MM throws ParsingException

sand drift
#

Because the component level one is a warning

#

MM enforces it

sweet hornet
#

In 99.9% of the case, when the legacy symbol is found, that's because of an error, so it is good to have it fail I think. In that case, @copper oriole I think you should just switch to something like §.3 or so, to denote paragraph no. 3... But may I ask, are you not using that in a Minecraft context? Because MC client doesn't render the § symbol anyway

copper oriole
#

In a dialog I have it featured yeah

sweet hornet
#

But have you tested that the in-game dialog renders it correctly?

cunning folio
#

still like this 😭

sweet hornet
#

You have concatenated multiple components together

#

With + between their String representation

#

You can clearly see the concatenation on middle of the fourth line

cunning folio
#

oh

sweet hornet
#

...children=[]}]}TextComponentImpl{...

sour totem
#

use the append method for appending components together

cunning folio
#

ill just turn everythibg into a component

sweet hornet
#

Yes, when working with components, you should prohibit Strings as they are just source of confusion and bugs

cunning folio
#

yeah im just kinda new to adventure api

sweet hornet
#

nw

#

We're here to help

cunning folio
#

i successfully retired from chatcolor lol

wispy folio
#

how can I convert strings that contain legacy &0-9/a-f color codes to components?

cloud vapor
#

legacy component serializer

arctic drum
#

Hi, why can't Components accept null values ​​and convert them to strings like String.valueOf() does?

Because using Component.text(String.valueOf()) for security quickly becomes repetitive.

sweet hornet
#

Why would you want to pass null?

arctic drum
#

For safety reasons, I have many components and I don't want to get an error because one of them is null; I prefer to display null rather than return an error.

arctic drum
#

Thank you for clarifying...

sterile rampart
#

but like, you should be validating your data, not just silently passing garbage

cloud vapor
#

or at least Objects.requireNonNullElse

boreal orchid
#

Components are supposed to be rendered, and unless you are logging debugging data, rendering null to a user sounds weird

#

often enough people will go out of their way to localize null to "none" or "N/A" if not outright send something completely different

arctic drum
#

Yes, but I mean, it's very repetitive, e.g., Component.text(Objects.requireNonNullElse(playerOffline.getName())).

I meant, if I don't know, the adventure is so big, maybe there's a NullableComponent or something.

cloud vapor
#

You could look into ComponentLike and just extract that logic into whatever your playerOffline type is

#

like if your issue is "im writing the same code over and over again" the solution is to extract that logic into a util function somewhere

#

the solution isn't adjusting the library design to be worse

arctic drum
#

I see, but it's quite disturbing and adding a component type, I don't see how that would degrade the library, but whatever.

boreal orchid
#

you could probably PR to Paper a name() method for OfflinePlayer that returns a Component (for parity with Player in a sense), though it'd still be nullable given that you can have an OfflinePlayer object without a name

arctic drum
cloud vapor
#

Increasing the surface area of the API to prevent a simple null check just isn't worth it. We have to consider complexity, maintenance, ease of use, etc. Even something as simple as "adding a null-friendly constructor" would introduce additional complexity and the possibility of unexpected behaviour.

cloud vapor
#

in a few places i have code that works around this with ComponentLike, here's a simple example

class MyPlayerObject : ComponentLike {
  val username: String?

  override fun asComponent(): Component {
    return Component.text(this.username ?: "unknown")
  }
}
arctic drum
#

Mais oui, passer player.getName() dans un composant serait parfait (ainsi que OfflinePlayer).

Je peux voir afin de faire une PR mais je veux dire que mon problème ne sera pas réglé des demain ahah xD

#

oups

#

baguette

#

Yes, passing player.getName() in a component would be perfect (as would OfflinePlayer).

I can look into making a pull request, but I mean, my problem won't be fixed tomorrow, haha ​​xD

#

🤡

boreal orchid
#

I was specifically talking about that case because I realized there was an opportunity for API parity, but yes, it won't solve your problem. Though I don't think you often encounter places where you are manually turning nullable strings into components

#

or at least I haven't found myself doing that, maybe the null checks were something I just did so I forgot the places where I did

cloud vapor
#

tbf i do it very regularly with offline player usernames, but i don't have as much of a problem with that as kotlin's elvis operator makes that v easy

#

so i do understand the problem

arctic drum
#

I'm going to try to submit a PR, but I never really know how to contribute haha ​​(I'll figure it out after checking if someone hasn't already done it)

sweet hornet
#

Imo, you need to consider why you could get null in the first place. As outlined previously, there isn't a single way to handle a null. Maybe in your case Component.text("null") might be ok, but in most case another text should be used. So I think you should end up with something either like Component.text(Object.requireNonNullElse(offlinePlayer.getName(), "Joueur inconnu")) (i.e. a fallback text), or even a completely other component when it is null (for example to show instead the UUID in italic red styling). So would really benefit from having, as Kezz suggested, a util method somewhere like this:

public static Component offlinePlayerName(OfflinePlayer offlinePlayer) {
    String name = offlinePlayer.getName();
    return name == null ? /* your fallback here */ : Component.text(name);
}

I'll be as easy to use as Component.text(offlinePlayer.getName()), it'll just be instead Utils.offlinePlayerName(offlinePlayer) that's it

sterile star
#

I say more often, but in reality I have never used it a single time

#

Correction: I should start using it, that looks really useful lmao

whole lark
sterile star
#

You do realize I meant in my own code, right

whole lark
#

Yes

sterile star
#

As in making my classes implement it

arctic drum
#

Making the transition from getName to a component seems complicated to me, there are so many things that would need to be changed.

whole lark
sterile star
#

Well, then you can still manually call asComponent

#

So nothing lost I guess

cloud vapor
#

i mostly like it in component joining, here's an example from some code im near atm

listOf(
  userProfile,
  Component.text(" is currently ", AQUA),
  onlineStatus,
  Component.text(".", AQUA),
).join().let(player::sendMessage)
sterile star
#

Why not just use ```kts
player.sendMessage(Component.textOfChildren(
userProfile,
Component.text(" is currently ", AQUA),
onlineStatus,
Component.text(".", AQUA)
))

#

The list joining seems obsolete?

cloud vapor
#

because i hate textOfChildren

sterile star
#

Why sadge

cloud vapor
#

it was added against my will and i refuse to use it out of love for the joining api

sterile star
boreal orchid
#

that works well with kotlin but join API would be very verbose for that use case in java lol

sterile star
#

Yeah I was also about to ask, how does that look in Java

rare sage
#

against your will

#

gun to the head

cloud vapor
#

it was

#

abby kidnapped my fiance and forced me to approve it

#

this is real

boreal orchid
sterile star
#

Is that really the same code?

boreal orchid
#

didn't need the List.of since there's an overload with a varargs

sterile star
#

Your parentheses placement is making me go insane

boreal orchid
#

as always 😛

sterile star
#

Yeah I don't think I have ever seen a single code block from you which makes me go "this code is nice to look at"

wet kestrel
#

Adventure doesn't have a Player class, does it? Is this about Paper's API?

arctic drum
#

oh sorry

#

Yes, it's Paper API and it doesn't belong here.

prisma mason
#

I mean its ComponentLike discussion from what I understand

gray quarry
#

a while ago I saw someone made a thing allowing you to input base64 and and send a sprite player head in chat textured via that base64 via their own thing but I can't seem to find it anymore does anyone know where that msg is? (it was in this chat )

gray quarry
#

ty

patent fable
mental vineBOT
mental vineBOT
mental vineBOT
cloud vapor
patent fable
#

no trying to have persistent files for players

cloud vapor
#

right so you're just going nbt <-> object right?

patent fable
#

yes

cloud vapor
#

so just BinaryTagIO.writer/reader ?

patent fable
#

yea

cloud vapor
#

so what's the issue? it's like 1 loc to read/write

patent fable
#

I'm just asking if this is how I'm meant to use the Codec class

cloud vapor
#

i mean not really

patent fable
#

Then what alternative should I use

cloud vapor
#

it's not a replacement for e.g. dfu codec

patent fable
#

yeah but dfu is based on nms right

#

not adventure

#

then I have to convert every time

cloud vapor
#

dfu is nms

patent fable
#

I don't mind using it but I mind the datatypes being nms

cloud vapor
#

converting every time is basically what you're doing with those codecs, like yeah sure you can do that that's fine

#

or you can use codecs like vanilla does

#

i feel like you might be better off just using a proper serialization framework/library/format

patent fable
#

Do you have a suggestion, I kind of dislike NBTAPI

cloud vapor
#

only one i know of is kotlinx.serialization has an nbt library

#

but like, you can just use anything - find yourself a nice clean json library or smth

#

you don't have to use nbt - it's effectively a proprietary format so you're gonna have a better time using something proper like json or protobuf or sqlite or anything

patent fable
#

I generally always liked nbt tho

#

Are codecs not coming to adventure, like in the way I try to use them

#

or the way the work in nms

cloud vapor
#

then you're gonna have to deal with the fact there are basically zero good libraries for it

#

we'll likely have a dfu library yeah, but it won't be a codec clone just working with dfu codecs

patent fable
#

but part of paper?

#

like as in backwards compatibility and shit

boreal orchid
#

I don't think that's a question that can be answered now

cloud vapor
#

no it'll be a standalone library working with dfu directly

#

nothing to do with paper

sweet hornet
#

I haven't tested it, but I am working quite a lot with the Jackson Java library (through the YAML dataformat), but after a quick Google search, it seems someone made a NBT dataformat for it

patent fable
#

It seems to be for kotlin tho

sweet hornet
#

No, Jackson is for Java

cloud vapor
#

did you even read the readme example haha

sweet hornet
#

(but I guess it can work with Kotlin as well, I'm not using Kotlin)

patent fable
#

That's lwk strange since the whole thing is coded in kotlin

#

I didn't know you can mix methods like that

#

I thought they could just run alongside on the jvm

cloud vapor
#

kotlin just compiles to the same old bytecode as anything else

patent fable
#

and like not ineract

cloud vapor
sweet hornet
#

Kotlin is just a JVM language, it can be called by Java code (kind of)

patent fable
#

yeah I know I just wasn't aware jvm based languages could "talk" to each other aside from running on the same runtime

sweet hornet
#

That's the whole point of running on the same runtime

patent fable
#

right but how does the java compiler track kotlin methods just seems weird that they have to account for the kotlin language, also what is like the order how is that based, since a kotlin class might require a java method and the java class might require a kotlin method so which gets compiled first

sweet hornet
#

But if you never worked with Jackson, you might either want to give it a try to discover/learn that library (outside of NBT/Minecraft context), or just use something else, since it's a big big library, widely used, but not the easiest to use for a beginner I'd say

patent fable
#

Ive only used gson, I've heard of jackson json tho

#

never used it

cloud vapor
#

i mean when stuff is compiled doesn't matter - a method in bytecode is the same method whether it was written in java, scala, kotlin, etc

patent fable
cloud vapor
#

in what world are you depending on something that hasn't been compiled

patent fable
#

before runtime

#

when you're compiling

sweet hornet
cloud vapor
#

if you are depending on a library that library was compiled

sweet hornet
#

Before compiling your App, the Library was already compiled

gentle pulsar
#

How can I achieve style leakage with components?

I want to inject a color key using #replaceText (color is a string converted by my coloring parser string->component). However adventure "isolates" it making the only colored part the thing I've injected, not stuff after even with reset styling.

sweet hornet
#

Are you talking about legacy color codes?

gentle pulsar
#

using minedown with certain things changed but essentially minedown format string to component

#

and what i'm injecting into is a system message (component)

sweet hornet
#

I don't know Minedown, can you provide an example?

gentle pulsar
#

it's a placeholder system

gentle pulsar
sweet hornet
#

Why not using MiniMessage?

gentle pulsar
#

preference mainly due to the markdown-like format and simplicity (in-built hover etc.)

#

and backwards support for legacy &f, &b etc.

sweet hornet
#

But is Minedown supposed to be used with adventure components or not?

gentle pulsar
#

what i wanna achieve is injecting component in the middle of another component overriding styling past injection point if none is defined

gentle pulsar
#

im using the adventure artifact

sweet hornet
#

And since Minedown is a placeholder system, doesn't it have a built-in way to do that?

gentle pulsar
#

no, minedown is a color parser like minimessage

#

placeholder system is what im making

sweet hornet
#

If you need to have Minedown process the whole string at the end, maybe you should work with strings and not components for your placeholders?

gentle pulsar
#

my input is components (thats what packetevents returns for SYSTEM_MESSAGE)

#

but converting to string (with coloring preserved) would be a good solution, just how?

sweet hornet
#

Idk, you said that Minedown was designed to work with adventure components, so they must have a serializer?

gentle pulsar
#

i don't think it has component->string unfortunately

#

actually...

#

lemme try something

#

it has a #stringify method, perfect

appreciate your help

steel fulcrum
#

Paper 26 release date?

rare sage
#

every time someone asks, the release date gets delayed by 3 months

sweet hornet
prisma mason
hardy estuary
#

Hello, Component.text() isn't able to resolve minimessage tags right?

sterile star
#

You could almost view MiniMessage as a separate project to the main Adventure API (it basically is)

hardy estuary
#

mmm maybe is ViaVersion, but in Paper 1.21.11-127 I have a strange situation

#

im trying without viaversion now to see if its that

sterile star
#

You are now talking about two different things. Mind saying what you are attempting to do and what is instead happening?

hardy estuary
#

I use Component.text() to componentize a chat input.

To replace this chat input while using Minimessage for example to apply a format

%player% -> <message>

I use Placeholder.component(Component), this way it wont parse untrusted tags

But it seems in 1.21.11 these tags are being resolved. I always did my tests locally in 1.21.8 without viaversion

sterile star
#

The tags which actually get resolved depend on the MiniMessage instance and any additional tag resolvers you add to the deserialize method

#

So you would need to also remove any untrusted tags from the MiniMessage instance you are using

#

I cannot explain to you why it worked for you in 1.21.8, but MiniMessage (de)serialization is an entirely server-side process which mostly shouldn't be affected by server or client version

hardy estuary
#

it is still working without viaversion, I am trying back in 1.21.8 and explain better the pipeline

#

mm this is the pipeline

  1. Component.text(String), the String is obtained by PLAIN serializer on the chat message
  2. In the moment it needs to be formatted

I have a minimessage instance

the format goes to this minimessage instance, in which I pass the TagResolver which contains the Placeholder.component("message", component)

sterile star
#

Okay sure, that's how chat formatting is typically implemented

#

And what is your problem?

hardy estuary
#

oh I know have a better picture

#

if user type some minimessage tags like "<red>hello" its not get parsed

#

but

#

if he types newline

#

<gold><newline><newline><b>REWARDS</b></gold><newline><newline><newline>Get Ur playtime reward !<newline><aqua>GET UR KEY <yellow><b><click:run_command:/pay Cawv 1 >→ <u>Click Here<newline>

#

this get parsed

sterile star
#

Huh. Could you send a concrete code snipped?

hardy estuary
#

if you want I am able todo vocal?

#

in order to make a better snippet

sterile star
#

No, I understand your problem now, but I cannot really understand how the top one doesn't work whilst the second one does

#

So you are probably doing something wrong with the component inserting after all

#

Are you sure that you are using Placeholder.component and not Placeholder.parsed?

hardy estuary
#

yep

#

Im making now a mini plugin to test it

#

in order to give a snippet

#

can we move this chat in a private ticket?

sterile star
#

Why not just copy the code from your current code

hardy estuary
#

an cancel everything above?

sterile star
hardy estuary
#

allright

hardy estuary
#

cause code is long

hardy estuary
#

yes its my fault, I replicate the pipeline and I don't have the same issue, so its my fault

stark badger
#

@hardy patio

#

<@&748618676189528155>

stark badger
digital goblet
#

Is there any interface or smth that would contain the player name?

wet kestrel
digital goblet
#

none

#

im doing a common lib for skins so I need to get the username and since paper & velocity all should support adventure and since it got like everything abstract theres no way there isnt a way to get the username right???

#

i can get the uuid(from Identity) but i cant get the username

sour totem
digital goblet
#

danke

copper cave
#

it would be nice to have documentation about the new hover event show_item format

sand drift
#

format?

copper cave
#

it used to be SNBT hover:show_item:<id>:<optional count>:<snbt> but it's now hover:show_item:<id>:<optional count>:<data component key 1>:<data component value 1>:<data component key 2>:<data component value 2>:<...>>

prisma mason
#

That is a adventure 5.0.0 change which hasn't been released yet

#

I see Kezz hasn't updated the tag in Adventure 5.0 docs PR however, if you want you can comment on it to let them know

copper cave
#

it looks like it's already present in 4.26.1 as well

prisma mason
#

hmm

#

interesting

copper cave
#

5.0.0 drops support for SNBT and 4.26.1 supports both

prisma mason
#

yeah I see that know

#

mind opening an issue on the docs?

copper cave
#

sure :)

steady sedge
#

Hey, can I somehow get the initial input out of an TextComponent?

For example:

final String TEXT = "<greeen><bold>Test</bold></green>";
final Component component = MiniMessage.miniMessage().deserialize(TEXT);

How would I get TEXT back from the component? The PlainTextComponentSerializer strips the color codes...

robust wharf
#

minimessage is a serializer too 🙂

#

it might not be exactly the same, but visually the same

steady sedge
#

Ah, makes sense... Should have found that one myself 😑 Thank you very much, I appreciate it! 🙏

stark kiln
#

Hey! The message in Paper's AsyncChatEvent is an Adventure Component. If I'd like to add some replacements/placeholders to the chat, e.g. to replace [pos] with another Component containing player's position, what's the proper way to do that?

boreal orchid
#

I think people just don't do that anymore? Given it messes with signed messages

sterile star
# stark kiln Hey! The message in Paper's `AsyncChatEvent` is an Adventure Component. If I'd l...

The first step would be to serialize the message component as plain text. Luckily, players don't type in components, otherwise it would be a bit awkward. You now have a string. You should then replace your placeholder [pos] into a minimessage tag format <pos>, so that they can be parsed by MiniMessage. You can then use a very minimal MiniMessage serializer instance with only your custom components added using Placeholder.component. Make sure your MiniMessage instance has no standard tags, otherwise people will be able to write in color and whatnot. After that, serialize the replaced string message with your mm instance and you have the parsed component you can just set as the message again

boreal orchid
#

does that not break the chat chain

sterile star
#

I don't know a whole lot of people who care anyways

sweet hornet
#

Who cares?

#

Lots of servers purposedly disabled signed chat

sterile star
#

I consider chat signing a "nice to have", not something you need to support at all costs

sweet hornet
#

So players can't be reported

stark kiln
#

Yeah, it it was a public plugin maybe it would be worth considering, but it's only for myself

sterile star
#

If it breaks when you have a nice chat format idea, well, whatever

rare sage
#

i mean you can also just use Component#replaceText but whatevs

boreal orchid
#

yeah but that's sucky when you have more than one placeholder

sterile star
rare sage
#

? you provide a component

sweet hornet
#

You can replace by a component

sterile star
#

Ah that's cool

rare sage
sterile star
#

Set is cooler thinksmart

boreal orchid
#

I guess with chat specifically you don't really have to care about component children unless another plugin was modifying message as well

primal apex
#

Someone knows why my h tag is not being resolved?

hardy estuary
boreal orchid
#

unrelated but you can just use Placeholder.styling("h", TextColor...)

rare sage
#

what is message ?

primal apex
primal apex
sand drift
#

I mean, the source of "just a string" is generally important

#

if you're deserialising a component with MM, it will escape the text contents so they're not just blindly parsed

primal apex
#

Thanks haha

winter socket
#

hey this is a bit of a silly question but Key#key warns me for unsubstituted expression, there are ways to make sure I'm providing a valid key whether via Key#parseable or by catching InvalidKeyExceptions, but outside suppressing the PatternValidation warning is there any other way to safely parse a key without having to deal with IDE warnings?

boreal orchid
#

you can work it around by doing:

@Subst("some:placeholder")
var value = actualKeyToBeParsed;
var key = Key.key(value);

if it really annoys you

#

I prefer to just disable the inspection, only case where it is useful is when you're parsing a string literal and 90% of the time, you aren't doing that

winter socket
#

I see, thank you!

#

maybe I should just contribute a method that returns an optional 😅

boreal orchid
#

I think the @Pattern annotation should just be removed from that method rather than adding an additional one

#

the annotation is better suited for methods that are more commonly used with string literals, i.e. Commands.literal("whatever"), Key.key is more commonly used to parse user input and thus can't be statically validated

winter socket
#

I get what you mean, but having a second method not only makes it easier when you are parsing a literal, it also forces you to always make sure you're parsing valid keys; additionally it just makes intent clearer since instead of suppressing a warning you are explicitly writing .getOrThrow()

(edited to make it actually readable :p)

sweet hornet
#

Btw I already discussed about this last year

quaint monolith
#

Looks like if you made one it might get accepted

barren wolf
#

@winter socket lol yeah would be nice

hardy estuary
#

Hello, has Component a sort of way to hide for example a metadata and retrieve it?

robust wharf
#

whats the usecase here?

#

I would recommend storing data on actual game objects instead, like itemstacks or entities have PDC for that on paper

hardy estuary
sweet hornet
#

I know nothing about how DiscordSRV works, but I believe that it does not only send the component. There must be some additional data sent along. It would be really hacky to try to bundle those info inside the component, instead of simply having the component wrapped in a more general object, that can have additional data

hardy estuary
robust wharf
#

the proper way would be for discordsrv to fire a "DiscordMessageEvent" or something, pass all the data plus the message there, plugins can listen to that custom event, change change or cancel or whatever, and discordsrv then can look at the event result and look at what to do (if cancelled, nothing, else send message to channel that was set in the event)

hardy estuary
rare sage
hardy estuary
toxic ivy
#

Hi everyone, I'm getting this pointing to a forEach on Bukkit#getOnlinePlayers when running mvn install with 26.1.1:

No access: net.kyori.adventure.text.object.PlayerHeadObjectContents

Any ideas what might be causing that?

stark kiln
#

Hey! I have an issue with MiniMessage that causes items to not be stackable. From what I've observed, emitted components are different when I parse a MiniMessage string in plugins onEnable and when I do the same later, e.g. in a command.

I'm using MiniMessage.miniMessage()

I'm running Paper 1.21.11. The diff for /paper dumpitem is visible on a screenshot. What might be causing this?

fiery oracle
#

it would probably be more useful to have the text in a pastebin
also, the original source minimessage

proper sandal
#

did that linearize pr ever get merged?

boreal orchid
proper sandal
boreal orchid
#

a component will always be a tree even if the contents is just a single node

proper sandal
#

yeah but the component children were leaves, they had no children

#

it copied styles and whatnot

boreal orchid
proper sandal
#

does that ensure you'll end up with a depth-1 component?

sterile rampart
#

I don't see any PR's for that, and I don't see why you'd want that

#

there is ComponentFlattener already for display

arctic sandal
#

god damit

wet kestrel
sweet hornet
proper sandal
proper sandal
sterile rampart
#

that's entirely different than what you were asking lol

proper sandal
#

splitting is much easier once you have a flattened structure to work with

sterile rampart
#

but nobody's been interested enough to PR it

sterile rampart
proper sandal
#

I needed it at some point for lores

sterile rampart
#

better to do it correctly

proper sandal
sterile rampart
#

implement it in a way that preserves the hierarchy

proper sandal
#

I'd rather just use what exists, having 15 components organized differently really does not make a difference

hardy estuary
#

Hi, is there by any chance a way to center a component?

<center>Hello<newline><center>how are you?

I know <center> doesn't exists, mostly asking if there is a way in the API

sand drift
#

no

hardy estuary
#

thank you!

To center a text, is sufficient to append space before and after the text? Counting that the text line is 255 in minecraft?

sweet hornet
hardy estuary
#

Mostly I don't think there is an universal way? since if user change their GUI size in the client settings, they will see also chat bigger or smaller

sweet hornet
#

If you control client-side stuff (namely, the resource pack), you can enforce a specific font (with known size), so if you don't use any special components (only text or server-side translated components), you could compute it. But you'll still be missing info on the container's width

hardy estuary
#

so to do a recap, there isn't an universal way basically, since container's width changes according to user GUI size setting?

sweet hornet
#

It depends on what the container is, but basically yes some can be changed through client-side settings (chat, for example)

hardy estuary
#

thank you! Do you know where I can find more info about it?

sweet hornet
#

About what?

hardy estuary
#

the container width

sweet hornet
#

Where are you displaying your texts?

hardy estuary
#

chat

#

idea is to make announcement/broadcast centered

sweet hornet
rare sage
#

i mean, you can change the chat width of your client to be wider or narrower and there is absolutely no way of knowing that from the server

sweet hornet
#

Here are the chat-related settings that the client could change

hardy estuary
#

thank you both guys for the help ❤️

sweet hornet
#

Namely, "Chat Text Size" and "Width"

boreal orchid
#

it is better to just not center things in chat

#

if you want something centered, just use an action bar message

rare sage
#

or a title ;o

hardy estuary
boreal orchid
sweet hornet
#

But yes, my recommendation would be to not try to center, as you might succeed for the "default" case, but it'll be screwed up when clients have custom settings or so

dull mesa
boreal orchid
#

I see the value for 1.8, didn't know people would still use them for newer versions lol

hardy estuary
dull mesa
#

and feather client

dull mesa
sweet hornet
#

To make a "clean" announcement, I would recommend you to do something like:

Random_User: Hi!

-----
[ANNOUNCEMENT]
> The actual announcement message
-----

Another_User: Yay

With sufficient spacing (1 line before and after) and clear demarcation (horizontal bars above and below), things get rather visible and really don't need any "centering"

dull mesa
#

or do you define the key urself for jumping

#

wait am I misunderstanding or does this not allow us to get keybinds of a player? huh am I tweaking 😭

sand drift
#

No, it just lets you send a message to the client and the client can replace the keybind with the actual keybind

dull mesa
cloud vapor
#

The client replaces it when rendering the component

dull mesa
#

yeah so if the player has left click for jump does it not say Press Left Click to jump!

cloud vapor
#

yep

dull mesa
#

so you can ...

#

get their keybinds?

cloud vapor
#

yes

dull mesa
#

what is it limited to?

#

can you get like the keybinds for drop key

#

and etc

cloud vapor
#

yep

dull mesa
#

wait ...

#

YO

quaint monolith
#

I mean, the server can't actually know what the keybind is, it just sends a marker the client fills in with the right keybind when displaying the message

#

But if you only care about displaying it and not knowing it then you're fine

dull mesa
#

aww so we can't access the information ourselves

#

🫠

#

like I wish can we not just like grab the info from chat 🥹

#

ufhghhhfh

#

I'm sad 😭

cloud vapor
#

Yeah

quaint monolith
#

No, if you render the message on the server the keybind isn't filled in since the server doesn't have any

cloud vapor
#

See "configurable controls" section on https://minecraft.wiki/w/Controls

Minecraft Wiki

Minecraft offers controls tailored for different input methods. While Java Edition is playable only with a keyboard and mouse, Bedrock Edition has a wider variety of control schemes in order to accommodate players across all platforms. These controls can be changed in the options menu.

cloud vapor
#

it's also kinda ugly bc it renders as q not Q

dull mesa
#

well you can like uppercase it!

#

idk

#

wait you cant

#

cuz u don't have the info

#

ufhhfufhh

#

man being able to track player keybinds would open so much information up

#

especially for servers like mcpvp

#

cuz you can detect stuff

dull mesa
#

binds*

#

well ig you wouldn't know

#

hmm

quaint monolith
#

That's up to the mod to figure out

cloud vapor
#

it kinda sucks

dull mesa
#

well that's fun info

#

I'm sad

serene hare
#

adventure 5.0 is available in the latest paper 26.1.2 builds already?

sour totem
#

no

serene hare
#

is there an eta?

upper tinselBOT
left spindle
#

is there a simple way to turn a HoverEvent.ShowItem into an ItemStack

sacred stump
#

Is adventure v5 abi compatible with v4 for non deprecated usage?

sweet hornet
#

iirc a simple recompile should be needed, at least that was the goal

sacred stump
#

so every plugin compiled before is broken? lol

sterile rampart
#

no

sterile rampart
sacred stump
#

epic 👍

sweet hornet
#

Ok I found the source of what I was saying:

Non-goals

#

So it was "at most" a recompile

#

So if it's not needed, great

sterile rampart
#

ya no one of the constraints of 5.0 was no ABI breaks if you aren't using anything deprecated in 4.26

sacred stump
#

I'll keep using v4 then to continue targetting java 8 :)

sterile rampart
#

seems silly, it's been years since mc ran on J8

sacred stump
#

I maintain an adventure library which supports 1.7.10

sterile rampart
#

oh my condolences

sweet hornet
#

That sounds painful

sacred stump
#

its fun

boreal orchid
#

I know there are 1.7.10 forks which up the java version used

#

could just go that direction instead

#

or was it the 1.8 ones, idk, both are old

cloud vapor
#

yeah p much anyone seriously running outdated versions in 2026 should be using modern java versions

sterile rampart
sacred stump
#

cool

#

might add support for lower versions also

sterile rampart
#

I mean they only added componrnts in like 1.7.2

sacred stump
#

Scoreboards were added in 1.5

sweet hornet
#

According to bStats, the number of servers running 1.8.8 or below (and with Java 8) is comically low: https://bstats.org/global/bukkit (yes, there's no "Paper" category on bStats)

boreal orchid
#

if you're going that wide of a version range and at the packet level, I'd look into moving most of my logic onto the netty pipeline given that I believe netty version wasn't updated as regularly (at least not in an abi-incompatible way)

#

of course, you'd have to transform bytes into Components in order to do that but eh

sacred stump
#

it already works, whatever

boreal orchid
#

wasn't it fun 😛

sacred stump
#

very fun

#

theres a script that runs over 50 different mc server versions to test the reflection

robust wharf
sweet hornet
#

Oh nice

winter socket
#

how do you beat the convenience of legacy codes with the boilerplate of components 😔

#

I really dislike legacy codes but they're just so convenient 😭, do people use minimessage outside player input for this?

green monolith
#

Yeah, people definitely use it inside their code directly as well

#

In that way it's similar to what you'd have without adventure where you'd have the boilerplate of ChatColor.GREEN + "My text" versus using "&aMy text". Here the former is also significantly longer.

winter socket
slate current
#

Personally I find the builder style component creation much nicer, but that's also an option

shadow wyvern
#

How'd I be able to use something similar to dynamic replacements in a minimessage translator

#

I guess I'd just have to do my logic and then just use an argument

#

Formatter#number would've been pretty cool

boreal orchid
#

Component.translatable("some.mm.message", Argument.tagResolver(...))

boreal orchid
#

I prefer just setting up global translator so that I am not using MM directly in code but just as the message format

#

otherwise, just using Adventure directly for any hardcoded component

shadow wyvern
sturdy swallow
#

how should i go about creating a custom component with adventure 5?

prisma mason
#

Custom as in how?

sturdy swallow
#

as in like if i wanted to make a new component

fiery oracle
#

that doesn't really clarify much
like, constructing a component? that didn't change much at all in adventure 5, beyond some changes to click events

sturdy swallow
#

no i mean creating a new type of component, like if i wanted to extend textcomponent or something
i know its removed because they dont want you to do you that now, but whats the alternative, and how do i use it

fiery oracle
#

One relatively common incorrect usage was to create custom Component implementations. This is now no longer possible, and you should instead be using the VirtualComponent API.

sturdy swallow
#

i mean i read that but didnt see the alternative, is it virtual components? but then how do i move from using a new component to virtual components

fiery oracle
#

i mean yes, it indeed states the alternative is using a VirtualComponent

sturdy swallow
#

but then how do i move from using a new component to virtual components

#

thats my entire issue

fiery oracle
#

i can't really tell you how to move whatever you're doing without knowing what you're doing

sturdy swallow
#

they dont give you any example

sturdy swallow
fiery oracle
#

once again, without specifics i can't really tell you much

sturdy swallow
#

oh wait

#

i can just use componentLike instead

#

we good

earnest wyvern
#

since TextComponent#toBuilderwill be removed in 5.0, is there any other way to convert a component into a builder? the deprecation message tells me to look at ComponentBuilder<?, ?> toBuilder() but i honestly have no clue what to do with that information 😅

rare sage
#

what's getting removed is BuildableComponent, Component retains the toBuilder method, though that does mean that if you are using toBuilder on a specific component subtype (like TextComponent) you'll get that deprecation, but it's fine

earnest wyvern
#

ahh alright thanks for clarifying!!

earnest wyvern
#

does the PlainTextComponentSerializer.plainText()#serialize] return anything for components that aren't TextComponent?

quaint monolith
#

Basic flattener (what that is using) will print out the Key for translations and key binds and such

#

I guess the text only one just doesn't print anything unless it's a text component?

flint cradle
#

Hey, I'm experiencing a problem when compiling a project that depends on GriefDefender which depends on net.kyori:event-api, no compilation errors occur because we don't depend on event-api directly but without adding net.kyori:event-api as an exclusion I can't package the jar. Does anyone have a fix for this?

#

please ping me if anyone responds

cloud vapor
#

what does that mean?

rare sage
#

but if GD has event-api classes exposed in their API without properly declaring a transitive dependency, that's… really all there is to it and until they fix that you'll have to manually add that dependency

forest flame
#

If developing for a version of paper that does not have the latest version of adventure, do you reccomend just using the bundled version of adventure for that mc version or to shade the latest version of adventure in (if supported)?

rare sage
#

you should use the bundled version, and target a paper-api version that contains the api you want to use

forest flame
#

thank you

flint cradle
cloud vapor
#

okay and what does that mean

#

describe the problem, not what you're doing that surfaces the problem

flint cradle
# flint cradle Hey, I'm experiencing a problem when compiling a project that depends on GriefDe...

I thought that this would be enough, but sure.
A dependency(GriefDefender) of the plugin I'm working on(ProjectKorra) depends on net.kyori:event-api version 5.0.0, which is not accessible through the previously mentioned dependency(GriefDefender). Unless I exclude net.kyori:event-api, I can not compile the plugin(ProjectKorra):

[ERROR] Failed to read artifact descriptor for net.kyori:event-api:jar:5.0.0-SNAPSHOT
[ERROR]     Caused by: The following artifacts could not be resolved: net.kyori:event-api:pom:5.0.0-SNAPSHOT (absent): Could not transfer artifact net.kyori:event-api:pom:5.0.0-SNAPSHOT from/to spigot-sonatype-snapshots (https://hub.spigotmc.org/nexus/content/repositories/sonatype-nexus-snapshots/): status code: 403, reason phrase: Forbidden (403)```
Are there any workarounds other than excluding `net.kyori:event-api`?
sand drift
#

add the repo that that project exists in?

flint cradle
#

griefdefender's repo?

#

it alrady is in the repositories

sand drift
#

No, sonatype snapshots wherever that moved

flint cradle
#

that too

      <id>spigot-sonatype-snapshots</id>
      <url>https://hub.spigotmc.org/nexus/content/repositories/sonatype-nexus-snapshots/</url>
      <snapshots><enabled>true</enabled></snapshots>
    </repository>```
sand drift
#

then again, snapshots might expore from there

#

That's spigots repo

flint cradle
#

oh wait

#

sorry right

sand drift
#

Looks like phoenix616's repo has a copy of it if it's not accessible from the primary snapshots repo anymore, that all got messed around with so, idr what the official repo for that was

copper stag
stark badger
#

<@&748618676189528155>

#

twiddling my thumbs lol

vivid jetty
#

hello everyone, how to use new player component in adventure api? ({"player":"Notch"} in /tellraw)

mental vineBOT
prisma mason
#

I also reccomend checking out the MiniMessage format to make your life easier

mental vineBOT
boreal orchid
prisma mason
#

or

player.sendRichMessage("<head:Notch>");

if using MiniMessage

lilac junco
#

I've been going through the localization page
https://docs.papermc.io/adventure/localization/

How do people actually handle this in practice?

Do most people go through the resourcepack route, or do they parse the keys manually from files into a translation store?

fiery oracle
#

(obviously this depends on platform, but in regard to paper:) if you want to use the translations on items or in dialogs, then you have to use resource pack translations for those

#

otherwise, server-side translations are more flexible/you can do more with them

raven crag
#

I develop custom plugins for my own server in a monorepo, and for the most part I don't use third-party plugins. I went the resource pack route, but I kinda regret it because I have to use flaky scripts to parse translation keys and their English fallbacks out of my code.

lilac junco
boreal orchid
#

yes

#

MiniMessageTranslationStore is very easy to setup

lilac junco
#

And additional question is how do people generally structure their files for this?

boreal orchid
lilac junco
#

I haven't seen MM's translation store, will look at it

boreal orchid
#

this is an example of how people usually go about it

#

well that one is actually using json, it's usually through resource bundles

lilac junco
#

For the json files being loaded there, do people usually do

resources/langs 
    en_US.json
    ...

?

fiery oracle
#

usually people use properties files w/ resource bundles

lilac junco
#

Huh, what are properties files?

boreal orchid
#

translations_en_US.properties:

some.translation.key=<red>a value
lilac junco
#

Ah, I see. And you bundle this for all locales in

near valley
#

alright it's been another 4 months

#

how is dialog support going?

upper tinselBOT
near valley
#

I'm not asking when it will be done I'm asking if someone even started working on it

knotty mango
#

does adventure include scoreboard stuff

upper tinselBOT
knotty mango
#

I can't figure out where documentation for scoreboard stuff is

tawny bolt
#

I mean its just like vanilla?

#

So, the Minecraft Wiki

#

Unless you specifically mean the sidebar and just want to use it to display some text.
In that case I would recommend using some library like FastBoard (which supports adventure nicely), because dealing with teams and objectives yourself just for text display gets annoying quickly

knotty mango
#

I've found that beginning with abstractions can hurt my understanding

knotty mango
#

just raw teams/objectives

tawny bolt
#

I mean that is a paper-supported way to do it

#

Thats how the scoreboard system works in vanilla.
The sidebar is just one feature of it

knotty mango
wispy folio
#

just a java.lang.String

cloud vapor
#

that doesn't answer the question

#

a string containing what

wispy folio
#

the raw text without any formatting / coloring

cloud vapor
#

so plain text?

#

see PlainTextComponentSerializer

wispy folio
#

I see thank you ^_^

obtuse yew
#

Im having a ton of problems with ping... I use minekube connect for tunneling. And I was wondering if the high ping was my plugins / server or just minekube?

sweet hornet
#

I think this is not the correct channel

stark badger
static flare
#

Is it possible to use the <sprite> tag with a custom resource pack? I cant seem to guess my way into the proper formatting.
resources/assets/hideandseek/textures/misc/play_tag.png

<sprite:"hideandseek:misc":misc/play_tag> doesnt seem to work, roughly following the example on the docs, just shows up as a white rectangle

boreal orchid
#

aka assets/<namespace>/textures/<atlas dir>, i.e. if you added a sprite to the items atlas then you'd do <sprite:"items":"hideandseek:item/play_tag">

static flare
#

was just about to ask about the atlas part until you edited, was reading about that in the mccommands discord because I figured thered be more examples there and thought I was doing something wrong

#

ty

boreal orchid
#

I do wonder if minecraft will add support for custom atlases at some point

static flare
#

Would be nice if you could just simply point to namespace:path/texture but I assume it needs to go through atlases for some reason

boreal orchid
#

well, atlases are in charge of stitching sprites together so that they're performant to display. Otherwise they'd be expensive to render and just overall a lot more bloated than they need to be in terms of vram

#

though I didn't really understand any of this till this moment given I was just checking out how the whole thing works in mcsrc.dev so you may take that with a grain of salt lol (not that it'd be strange though, it is pretty standard thing to do in game dev)

#

I also realized that you can do animated sprites after looking through that code, which is cool. Could probably do some fancy effects with that and not spam chat like one usually does for animated stuff in chat (though I am sure the same thing can be achieved by (ab)using shaders, I've seen it before)

old ether
#

how should i use adventures NBT library

cloud vapor
#

do you have a specific question?

old ether
#

well im just getting started migrating all my stuff to adventuers nbt library so i can use their own NBT to Component methods, how should I read <1.20.2 NBT (blank name), or 1.20.2+ NBT (no name data)

#

the papermc docs have nothing about adventures nbt

cloud vapor
#

did you have a look through the javadocs? it's not a complicated library - do you have any specific issues or examples of what you're trying to do that you couldn't before?

old ether
#

alr let me take a look

#

and now its the task of migrating all of my nbt stuff

#

Cannot resolve symbol 'CompoundBinaryTag'

i loaded it in pom.xml?
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-nbt</artifactId>
<version>4.26.1</version>
</dependency>

cloud vapor
#

Make sure you refresh dependencies, check build errors if any

old ether
#

i've refreshed but its doing this
[WARNING] Failed to download adventure-nbt-4.26.1.pom [https://jitpack.io/]
[WARNING] Failed to download adventure-nbt-4.26.1.jar [https://jitpack.io/]

this is the only one i've loaded
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>

cloud vapor
#

we don't publish to jitpack

old ether
#

where do you publish to

cloud vapor
#

maven central

old ether
#

because every other adventure library loads

#

ye thats weird

#

im also loading from maven central

#

only nbt doesn't load

#

Cannot resolve symbol 'CompoundBinaryTag'

#

import net.kyori.adventure.nbt.CompoundBinaryTag;

old ether
#

kk

#

let me maven refresh

#

Cannot resolve symbol 'CompoundBinaryTag' hmm

#

i dont see any sync errors

cloud vapor
#

i cant help you with ide/build issues

old ether
#

im gonna try version 5.0.0

#

NOPE.

wet kestrel
#

Problem with your build setup.

old ether
#

do you know what problem that would maybe be?

cloud vapor
#

no need to cross post, you are going to get the best support about build tooling issues from the build tooling help channel

old ether
#

ye i got it fixed

#

turns out, i was using the WRONG ADVENTURE VERSIONS

#

AAAAAAA

#

alright heres a actual question, how do i turn a Component into a NBT tag and vice versa

old ether
#

because i have to handle SystemChat

#

which uses a Text Component (NBT)

prisma mason
#

can I suggest an alternative that doesn't require such constraints?

old ether
#

kk

#

what is that alternative

#

because i need to get NBT for the packet

prisma mason
prisma mason
old ether
#

IM NOT TALKING ABOUT CHAT SIGNIN-

#

this

prisma mason
#

why are you using packets to send a message to a client?

old ether
#

uh

#

maybe because im developing a proxy

#

and i dont have any such thing as paper or velocity api

#

so theres no way

prisma mason
#

oh my bad

old ether
#

unless i do the packe

prisma mason
#

sorry but my knowledge of implementing Adventure is a bit dry

robust wharf
#

You will have to write your own codec like thing then

prisma mason
#

you could try the unmerged PR for NBT serializer

old ether
#

u know what im just gonna look at velocity code

robust wharf
#

Or you could round trip via json I guess, if your nbt I impl can do that

prisma mason
#

that is also a good idea

old ether
#

" adventure-text-serializer-nbt "

#

i see

#

thats a thing

old ether
#

how should i SNBT it

#

actually i prob wont need it

#

actually yes i will need it

#

so uh

#

how

#

nvm again

#

alright heres a reasked question

#

how should I read <1.20.2 NBT (blank name), or 1.20.2+ NBT (no name data)?

cloud vapor
#

i still don't really know what you're asking for

old ether
#

like

#

i have a ByteBuf

#

i need to read the <1.20.2 NBT

#

and the 1.20.2+ NBT

#

theres 2 versions

cloud vapor
#

is there?

old ether
#

let me check

#

i swear that exists

#

oh i hate this stupid mc wiki documentation

#

theres like 2 seperate NBT pages

#

@cloud vapor

cloud vapor
#

i don't think that matters?

old ether
#

sure

#

how do i read NBT then?

#

public static BinaryTag readBinaryTag(ByteBuf buf, ProtocolVersion version,
BinaryTagIO.Reader reader) {
BinaryTagType<?> type = BINARY_TAG_TYPES[buf.readByte()];
if (version.lessThan(ProtocolVersion.MINECRAFT_1_20_2)) {
buf.skipBytes(buf.readUnsignedShort());
}
try {
return type.read(new ByteBufInputStream(buf));
} catch (IOException thrown) {
throw new DecoderException("Unable to parse BinaryTag, full error: " + thrown.getMessage());
}
}
velociyt just skips it lel

cloud vapor
#

see the javadocs - you're looking for the reader/writer classes

old ether
#

found it in velocity lol

boreal orchid
#

like, they're passing the adventure-nbt reader but not using it at all lol

dull python
#

is this removable? it's a ClickEvent.runCommand

dull python
cloud vapor
#

you need a preceding /

#

in your minimessage

dull python
#

its there tho

cloud vapor
#

the popup says otherwise

cloud vapor
#

also check that the command exists, and isn't affected by that paper bug

dull python
runic onyx
#

How are you registering the command?

dull python
#

brig api + lifecycle manager

cloud vapor
#

does the command have a requires predicate

dull python
#

yeah, a perm check

cloud vapor
#

yeah that'll do it

dull python
#

does status:accepted mean it will be fixed in a later ver?

cloud vapor
#

you'll have to ask paper devs

dull python
rare sage
#

it just means it's a valid issue

dull python
rare sage
#

PaperMC != Paper

cloud vapor
#

we're in the PaperMC organisation yes, Paper the server software is just part of that, Adventure is another part

dull python
#

ohhhhhhhh

rare sage
#

capital A Adventure

#

strange

cloud vapor
#

this is the anarchy you get in the lawless lands of kezz maintenance

sterile star
kindred forge
#

Are there any news on that yet?

cloud vapor
#

No

ornate arrow
#

I'm trying to add custom translations to be shown in dialogs, but they don't render and only the translation key is shown to the user in the dialog. When sending the same translatable component directly to a player, it is rendered correctly - is this intended?

ornate arrow
cloud vapor
#

Paper doesn't render server side translations for dialogs, you'll need to do it yourself

#

see GlobalTranslator.render

boreal orchid
ornate arrow
#

I see, thanks for the help.

pseudo slate
#

Hello. How i can use <head> with "Value"? Custom minecraft heads have no UUID or player nickname.

pseudo slate
prisma mason
#

so a Base64 encoded texture?

#

the head tag doesn't support Base64 textures and probably never will. However, I'm pretty sure the API ObjectComponent does support them

robust wharf
#

MiniMessage is meant to be readable, pasting a giant base64 string doesn't seem readable to me

#

You can use a component placeholder and build a object component in java I guess

fiery oracle
prisma mason
#

this message should be pinned ngl

robust wharf
#

See, I don't think it should be in MiniMessage, that means I also don't think people should write that as an extension

#

It's just not readable

wet kestrel
#

How I'd do it:

In a config, a map of texture base64 and a nickname:

heads {
  "bobby": "9d6bdd07abe3f398720e5f010648c2c194a2ba0f5ef3e27013b0670336eb4f3c"
  "sally": "67d6bdd07abe3f398720e5f01048c2c194a2ba0f5ef3e27013b0670336eb4f3c"
}

Then, in the minimessage, you would be able to do like <heads:bobby>

dawn pewter
cloud vapor
#

no it isn't, you cannot read a base64 encoded texture and understand the resulting displayable content of the component

sweet hornet
#

I think its a matter of taste, because the head tag accepts an UUID, and I cannot myself understand the resulting displayable content of the component when reading an UUID ¯_(ツ)_/¯

#

So what each of us consider acceptable/readable or not is mainly personal preference, imo

#

Some may also argue that an HEX color code is not particularily readable either. Does it mean we should remove it from MM? I don't think so

elder forge
#

A bit of a stupid question, but do minimessage and adventure add lag, don't run on older server versions, or don't support other server software like Spigot, right?

sweet hornet
#

None of the above

#

Obviously you can add lag if you somehow decide to create billions of components in the same tick, but that won't be adventure's fault 😅

cloud vapor
#

worth noting we will eventually be dropping official support for -platform which provides support for very old (like 1.16 and older) versions and spigot support

fiery oracle
sweet hornet
#

Yeah, and it could be shortened to only the hash because this is the only domain allowed by Minecraft's client

hazy quiver
#

I can't find this explicitly written anywhere, but am I correct in assuming you can manipulate different Components in different threads safely so long as you don't actually do anything with them (like send one as a message)?

#

it'd be hard to imagine otherwise given they're immutable but would like to confirm

sour totem
#

the fact they're immutable means you basically get thread safety for free

hazy quiver
#

right, well conceivably there could have been some global data structures that the instance methods require for some reason

#

though I'd ask before I build an entire plugin around that assumption :)

boreal orchid
#

the biggest trouble you're going to face is thread safety around the consumers of Components rather than the Components themselves

wet kestrel
pseudo slate
robust wharf
dawn pewter
#

Just a general question, why don’t we move it to paper docs now that adventure moved to papermc?

robust wharf
#

you want to embed it or what do you mean?

sweet hornet
#

It is not embedded, but referenced by a link so it’s rather the same

dawn pewter
#

Why don’t we discontinue webui.advntr.dev in favour of integrating it in the paper docs

prisma mason
#

wouldn't it require a separate subdomain or at least special routing? The thing runs a Ktor server

dawn pewter
#

Idk I am just curious. I don’t say it has to happen.

prisma mason
#

well I do somewhat agree. It looks odd to be on a special domain rather than a PaperMC one

robust wharf
#

I never understood that domain, nor can I type it

dawn pewter
#

lets go

#

thank you

wispy wagon
#

is there any docs on the adventure virtual components?

#

I think I have a usecase for them but I dont really get how they work yet

#

My main question would be: How can I render the component and what the heck is Context in VirtualComponentRenderer?

green monolith
#

(I realise 5.1.0 and 5.1.1 are identical in terms of API, but I use one global adventure version property in my pom.xml and 5.1.0 doesn't work due to the publishing issue that was addressed in 5.1.1, but 5.1.1 fails due to the missing Javadocs.)

cloud vapor
#

Generally, context is whatever you want it to be (e.g. a player, a world, etc)

wispy wagon
# cloud vapor Do you wanna explain your use case a bit more and I'll point you in the right di...

So I do a lot of resourcepack trickery. A lot of it is generated automatically and I have mappings on my server for e.g. cafestube:test_inventory to the font cafestube:inventories and char x.
I now want to have the same for font glyphs (e.g. emojis, indicator icons etc.). However those icons get used in plenty of places like our custom bossbar (custom bossbar text is offset by a few pixels to accommodate for a border), inventory lines (we have custom fonts like inventory_text_0 which is the text in the center of inventory row 0, same for row 1, row 2 etc. with different ascents) etc and they need different ascents for each and every one of them.

Since different contexts might contain different amounts of glyphs because of optimization reasons (e.g. emojis are probably not required in inventories or bossbar), I cant just reuse the same unicodes over and over as they might eventually collide. The idea would be to have a GlyphMap for each context (default, inventory_0, inventory_1, bossbar etc.) and to use a lookup depending on context. Since I dont want to supply the context every time I create and declare a component (or I dont want to declare the context in minimessage for example), I thought I might use virtual components to finalize the component depending on wanted glyph map and fallback to the default glyph map if it isnt rendered.

My other idea would be to traverse the component, look for a font used in glyph maps and if yes, lookup the gylph in the glyph map and replace it with the equivalent glyph of the new glyph map. Dont know which is better, but I think virtual components would be great here. The only issue is that remapping no longer works after serialization but I dont think this is an issue (at least not yet).

#

-# (Man I wish mojang would just give us API's to do UI stuff 😭)

boreal orchid
#

though you would have to pass the context somewhere

wispy wagon
boreal orchid
wispy wagon
#

but how do I pass the context?

boreal orchid
wispy wagon
# boreal orchid it is passed the moment you instantiate the renderer
internal class GlyphComponentRenderer(
        val key: Key,
        val fallbackGlyphMap: String = "default"
    ) : VirtualComponentRenderer<GlyphMap> {
        override fun apply(context: GlyphMap): @UnknownNullability ComponentLike? {
            return context.getGlyph(key)
        }

        override fun fallbackString(): String {
            return MetadataProvider.instance.getMeta()
                .getGlyphMap(fallbackGlyphMap)
                .getGlyphUnicode(key)
                .toString()
        }
}

I thought I'd do something like this? How do I make it call apply with the glyphmap I want?

cloud vapor
#

I'm not sure how virtual components help you here, they're not a magic bullet. You're wanting to manipulate a component tree based on some context, you're gonna have to provide that context somehow.

Virtual components are best for if you need to operate on a component whilst it crosses the boundaries of another API. For example, MiniMessage uses it because the components enter the Paper API and then the renderer is called after. So the data it attaches to the components need to be preserved whilst the component is outside of your hands.

In your case, you've got control of the components the entire time. You're gonna find it much easier to simply have a custom MiniMessage tag that reads context your pass at serialize time.

wispy wagon
# cloud vapor I'm not sure how virtual components help you here, they're not a magic bullet. Y...

Ideally I want to include it in my inventory api etc. in a way where API consumers dont need to care about what they provide, API consumers should just expect it to look like the stuff they provided. So if they provide "glyph:testHi" to two separate API's of mine, my api would just rewrite that with the corrected glyph map.

I'm in control of the API that consumes the components, but I want future me or other developers to not need to care about what they pass in as it should just ⭐ magically ⭐ work. If vanilla stuff like sendMessage is called, it would use the fallbackString, which is the correct thing in that case.

But I don't fully get how to get to a point where apply is called with the context I want. How do I do that? Do I just need a function that traverses the component manually and replaces my virtual ones? How is this applyfunction intended to be called? Thats what the mystery is to me

boreal orchid
#

you could use virtual components, but it'd be annoying as you'd have to pass the context type somehow, like maybe with a scoped value or something

wispy wagon
#

the api just sees components, minimessage is provided at api consumer level

#

thats why I want this to happen with virtual components at an api level

#

if it makes sense

wispy wagon
#

because thats what I would have expected looking at the api

#

just like paper internally calls a translation api on components

#

I started browsing the adventure repo on github and either the github search isnt helping, or this apply function has absolutely no way to be called?

#

At that point it could have just been left out for users to declare manually, no?

boreal orchid
#

yeah frankly I've been searching and there doesn't seem to be any uses of it, it could be meant to be used in like, a ComponentRenderer but no idea

wispy wagon
#

Thats the only thing confusing me. This method seems entirely pointless.
I could write my own component renderer but I really dont want to bother with children 😭

#

and whatever else can hold sub-components

#

AbstractComponentRenderer also does not seem to have any handling for children pepeCryHands

#

I would have stolen code, but it seems like virtual components are barely use by anyone

#

Thinking about it, the idea might have been flawed from the beginning since what if a glyph comes from a TranslatableComponent. My renderer would sit in front of that, so it would skip that glyph then. I will need to consider if that is viable to accept then :/

burnt rock
#

Is minimessage the same as adventure?

sterile star
#

Nope

#

MiniMessage is a format you can use to represent Components (from Adventure) in a human-readable and editable way

burnt rock
#

I'm trying to find out if there is anyway to display heads in chat. I have managed to do it, but if there is anyway to use a "value" or Minecraft URL to display them instead of UUIDs of a player.

I don't know if this is a valid question for this support channel...

robust wharf
#

The object component should allow for that

#

MiniMessage doesn't because it wouldn't be readable

sour totem
burnt rock
#

found this, and all of those works. However then I need to select a player with that skin

sour totem
#

the message i linked shows you how

burnt rock
#

I see, i'm not a programmer tho. I'm using a plugin called interactivechat which has minimessage built in.

wispy wagon
#

you'd need to ask the devs then

#

to include this

boreal orchid
rugged leaf
#

Is it worth it to change all tag resolver things to be lazily loaded by using a component supplier instead of creating them directly? Or how does this even work?

I am introducing some tag revolvers in my plugin that might not be used, but could be for item generation. Might reduce lag?

Like go from this

Placeholder.component("my_tag", Component.text("something"))

To this

Placeholder.component("my_tag", () -> Component.text("something"))
#

Like might be used, as it's configurable by the user

sweet hornet
#

I mean, it depends whether you actually performs "heavy" computation to create the component. And then, you would probably want some caching to prevent computing it multiple times (i.e. to compute the component the first time and reuse value the next time). It’s called memoizing

In computing, memoization or memoisation is an optimization technique used primarily to speed up computer programs. It works by storing the results of expensive calls to pure functions, so that these results can be returned quickly should the same inputs occur again. It is a type of caching, normally implemented using a hash table, and a typical...

rugged leaf
#

The item has a lot of variables there, so I'm not too sure if momoization would be worth it

#

But good point

#

And, yes the computation is kind of heavy

cloud vapor
#

Is it heavy or do you just think it's heavy?

#

Do you have profiler reports?

rugged leaf
#

Not at the moment, just a recollection that generating these items is a heavy operation. I agree that I should definitely have more to go on before doing a change. I will profile a bit then update you on that later then.

lusty merlin
#

What is "the"?

#

Namespace?

boreal orchid
#

it is just nbt

#

can be whatever you want

lusty merlin
#

How do you listen for when it's clicked?

boreal orchid
#

I don't think Paper has an event for it outside of dialogs now that I look at it

#

it may also not work with the current adventure version Paper implements now that I look at the impl

lusty merlin
#

So do I just need to make it some random command and listen for that?

boreal orchid
#

adventure 4 simply didn't support custom payloads the way mini message's click tag was creating click events

boreal orchid
#

though you would still have the trouble of listening to the custom click

lusty merlin
#

But don't you run the problem that a player can somehow discover that command and send it at any time?

boreal orchid
#

in that case you can just use adventure click callbacks as well

cloud vapor
lusty merlin
#

Are there any docs on how to use that?

lusty merlin
#

I've never heard of that before. Thank you I will look into it.

lusty merlin
#

That did exactly what I needed. Thank you.

cloud vapor
#

glad to hear it!

hybrid bobcat
#

did adventure-api 5.1.0 file name get broken inside the repo?

rare sage
#

there was some missing things with publishing, which is why 5.1.1 got released :D

obsidian nimbus
#

Hey, does anyone have examples on setting up i18n for a plugin using mini message translator?

boreal orchid
obsidian nimbus
#

okay

boreal orchid
#

there's other thing you may want to handle, such as detecting the locale from the file name and loading the translations accordingly, reloading of the translation sources, namespacing the translation keys so that there's no opportunity for conflicts in the global translator

pseudo slate
#

Hello. How i can show ender_chest here? i try Look at my <sprite:blocks:block/ender_chest > or <sprite:"minecraft:items":item/ender_chest >, but its dont work

prisma mason
sweet hornet
pseudo slate
#

ah, okay... thanks

sweet hornet
#

(But if you can code, you can use custom heads of course)

prisma mason
#

are you sreu you couldn't use the chest atlas?

sweet hornet
#

It’s the whole texture, with all faces at once

#

Not 16x16

prisma mason
#

well why wouldn't

<sprite:chests:"entity/chest/ender">

work?

sweet hornet
#

Try 😉

#

You’ll understand better than with a thousand words

prisma mason
#

no please do tell

sweet hornet
#

It’s the raw texture image with all faces on a 2D image

prisma mason
#

oh I get it now

sweet hornet
#

I don’t know the English word for it

pseudo slate
sterile star
#

The full sprite sheet

pseudo slate
sweet hornet
#

In French, it’s called the « patron »

sterile star
#

I believe that's what an image with individual sprite faces is called

prisma mason
#

an atlas

#

oh that

sterile star
#

Atlas is technically something else

prisma mason
#

idk I just call it a texture

prisma mason
boreal orchid
#

that way you can just use a player head with that texture instead

#

otherwise, use a resource pack

tiny bone
#

how do i showcase a chest as a <sprite>?
sprite:items:item/chest
iam thinking it should be something with block but iam kinda lost

sweet hornet
#

Just read literally the messages above and you'll understand