Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Legacy serializer translates into the wrong order #81

Closed
Vankka opened this issue Jun 29, 2020 · 2 comments
Closed

Legacy serializer translates into the wrong order #81

Vankka opened this issue Jun 29, 2020 · 2 comments

Comments

@Vankka
Copy link

Vankka commented Jun 29, 2020

input: Your link code is &l4000&r. PM the bot on Discord (&l3XP3R1M3N2L B0T&r) containing just this &lcode&r as the &bmessage&r to link your accounts. with character &

here are the outputs with different versions of the library (api & legacy serializer):

adventure 4.0.0-SNAPSHOT (wrong works properly)

TextComponentImpl{content="Your link code is ", children=[
  TextComponentImpl{content="4000", children=[], style=Style{color=null, obfuscated=null, bold=true, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}}, 
  TextComponentImpl{content=". PM the bot on Discord (", children=[
    TextComponentImpl{content="3XP3R1M3N2L B0T", children=[], style=Style{color=null, obfuscated=null, bold=true, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}}
  ], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}}, 
  TextComponentImpl{content=") containing just this ", children=[
    TextComponentImpl{content="code", children=[], style=Style{color=null, obfuscated=null, bold=true, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}}
  ], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}}, 
  TextComponentImpl{content=" as the ", children=[], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}}, 
  TextComponentImpl{content="message", children=[], style=Style{color=aqua, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}}, 
  TextComponentImpl{content=" to link your accounts.", children=[], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}}
], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}}

text 3.0.1-3.0.4 (also wrong)

TextComponentImpl{content=Your link code is , children=[
  TextComponentImpl{content=4000, children=[], style=Style{color=null, obfuscated=null, bold=true, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}},
  TextComponentImpl{content=. PM the bot on Discord (, children=[], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}, 
  TextComponentImpl{content=) containing just this , children=[], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}, 
  TextComponentImpl{content= as the , children=[], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}, 
  TextComponentImpl{content=message, children=[], style=Style{color=aqua, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}, 
  TextComponentImpl{content= to link your accounts., children=[], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}, 
  TextComponentImpl{content=3XP3R1M3N2L B0T, children=[], style=Style{color=null, obfuscated=null, bold=true, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}, 
  TextComponentImpl{content=code, children=[], style=Style{color=null, obfuscated=null, bold=true, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}
], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}

text 3.0.0 (correct)

TextComponentImpl{content=Your link code is , children=[
  TextComponentImpl{content=4000, children=[], style=Style{color=null, obfuscated=null, bold=true, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}, 
  TextComponentImpl{content=. PM the bot on Discord (, children=[
    TextComponentImpl{content=3XP3R1M3N2L B0T, children=[], style=Style{color=null, obfuscated=null, bold=true, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}
  ], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}, 
  TextComponentImpl{content=) containing just this , children=[
    TextComponentImpl{content=code, children=[], style=Style{color=null, obfuscated=null, bold=true, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}
  ], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}, 
  TextComponentImpl{content= as the , children=[], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}, 
  TextComponentImpl{content=message, children=[], style=Style{color=aqua, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}, 
  TextComponentImpl{content= to link your accounts., children=[], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}
], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null}}
Vankka added a commit to DiscordSRV/DiscordSRV that referenced this issue Jun 29, 2020
zml2008 added a commit that referenced this issue Jun 29, 2020
@zml2008
Copy link
Member

zml2008 commented Jun 29, 2020

Hm that is interesting. I've set up a test case locally and am not able to reproduce this issue. Any tips on how you're deserializing legacy code? When I run this test case, I get:

TextComponentImpl{content="Your link code is ", children=[
    TextComponentImpl{content="4000", children=[], style=Style{color=null, obfuscated=null, bold=true, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}}, 
    TextComponentImpl{content=". PM the bot on Discord (", children=[
        TextComponentImpl{content="3XP3R1M3N2L B0T", children=[], style=Style{color=null, obfuscated=null, bold=true, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}}
    ], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}},
    TextComponentImpl{content=") containing just this ", children=[
        TextComponentImpl{content="code", children=[], style=Style{color=null, obfuscated=null, bold=true, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}}
    ], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}},
    TextComponentImpl{content=" as the ", children=[], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}},
    TextComponentImpl{content="message", children=[], style=Style{color=aqua, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}},
    TextComponentImpl{content=" to link your accounts.", children=[], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}}
], style=Style{color=null, obfuscated=null, bold=null, strikethrough=null, underlined=null, italic=null, clickEvent=null, hoverEvent=null, insertion=null, font=null}}

Does that test case look right to you?

It also looks like the snippet you've listed as being from adventure 4.0.0-SNAPSHOT is not actually from adventure -- notice that the Style toString output doesn't include a font field, while the one my test case has produced does, and the lack of quotes in your examples.

@Vankka
Copy link
Author

Vankka commented Jun 29, 2020

It also looks like the snippet you've listed as being from adventure 4.0.0-SNAPSHOT is not actually from adventure -- notice that the Style toString output doesn't include a font field, while the one my test case has produced does, and the lack of quotes in your examples.

Ah, yeah indeed wasn't on adventure, and appears that it's working properly on adventure.
Sorry about the troubles.

@Vankka Vankka closed this as completed Jun 29, 2020
zml2008 pushed a commit that referenced this issue Dec 7, 2021
fix: make unbalanced placeholder final
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants