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

Minimessage key components not working in chat (e.g. <key:key.hotbar.1>) #226

Closed
TheXplore opened this issue Aug 22, 2022 · 4 comments · Fixed by #339
Closed

Minimessage key components not working in chat (e.g. <key:key.hotbar.1>) #226

TheXplore opened this issue Aug 22, 2022 · 4 comments · Fixed by #339
Assignees
Labels
module:core Related to the core module type:bug Something isn't working as expected
Milestone

Comments

@TheXplore
Copy link

TheXplore commented Aug 22, 2022

Describe the bug

Key components sent via MiniMessage fail to be sent correctly.

image

How can the bug be reproduced?

  1. Install Triton
  2. Send minimessage to player which contains key komponent like "<key:key.hotbar.1>) Verreisen"
  3. Only ") Verreisen" gets sent to player

Expected behaviour

"1) Verreisen" should be shown instead of ") Verreisen"

Which Spigot fork are you using?

PaperMC

What's your server version?

git-Paper-408 (MC: 1.17.1) (Implementing API version 1.17.1-R0.1-SNAPSHOT) (Git: cc43ba7 on ver/1.17.1)

Which proxy are you using?

BungeeCord

What's your proxy version?

git:BungeeCord-Bootstrap:1.19-R0.1-SNAPSHOT:5cdba87:1659

What's the MC version of your client?

1.18

What's the Triton version you're using?

3.8.1

Additional Information

No response

@TheXplore TheXplore added the type:bug Something isn't working as expected label Aug 22, 2022
@TheXplore
Copy link
Author

Is there an estimate on when this might be fixed?
It's currently preventing us from using triton on our production network...

@diogotcorreia
Copy link
Member

This is fixed in the v4 beta and backporting the fix would be counter productive.
I'll work on making v4 work correctly on Spigot and Bungee!

@diogotcorreia diogotcorreia added this to the 4.0.0 milestone Sep 18, 2022
@diogotcorreia diogotcorreia moved this to In Progress in Triton Sep 18, 2022
@TheXplore
Copy link
Author

I wrote a small fix for this issue in our fork, so thats fine with me

@TheXplore
Copy link
Author

TheXplore commented Sep 20, 2022

For anyone else who wants to fix this before 4.0.0 releases:

com.rexcantor64.triton.language.parser.AdvancedComponent:

Line 97 (fromBaseComponent):

if (!onlyText && comp instanceof KeybindComponent) {
            	KeybindComponent kc = (KeybindComponent) comp;
                builder.append("\uE700")
                        .append(kc.getKeybind())
                        .append("\uE700");
}

Line 240 (toBaseComponent):

} else if (c == '\uE700') {
            i++;
            StringBuilder key = new StringBuilder();
               while (text.charAt(i) != '\uE700') {
                   key.append(text.charAt(i));
                   i++;
               }
               if (builder.length() != 0) {
                   component.setText(builder.toString());
                   builder = new StringBuilder();
                   BaseComponent previousComponent = component;
                   list.add(component);
                   component = new TextComponent("");
                   ComponentUtils.copyFormatting(previousComponent, component);
               }
               KeybindComponent kc = new KeybindComponent(key.toString());
               ComponentUtils.copyFormatting(component, kc);
               list.add(kc);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:core Related to the core module type:bug Something isn't working as expected
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants