question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Re-assembling chained-components doubles the contents

See original GitHub issue

Just wondering if this is intended behaviour:

                GsonComponentSerializer gsonComponentSerializer = GsonComponentSerializer.gson();
                String jsonString = "[\"\",{\"text\":\"abc\",\"color\":\"dark_blue\"},{\"text\":\"de\",\"color\":\"blue\"},{\"text\":\"fghi\",\"color\":\"green\"},{\"text\":\"jklm\",\"color\":\"dark_purple\"},{\"text\":\"nop\",\"color\":\"light_purple\"},{\"text\":\"qrs\",\"color\":\"red\"},{\"text\":\"tuv\",\"color\":\"dark_red\"},{\"text\":\"wx\",\"color\":\"gold\"},{\"text\":\"yz\",\"color\":\"yellow\"}]";
                Component component = gsonComponentSerializer.deserialize(jsonString);
                commandSender.sendMessage(component);
                List<Component> list = new ArrayList<>();
                component.iterable(ComponentIteratorType.DEPTH_FIRST).forEach(list::add);
                commandSender.sendMessage("component amount: " + list.size());

                Component rebuiltComponent = Component.text("");
                for (Component c : component.iterable(ComponentIteratorType.DEPTH_FIRST)) {
                    rebuiltComponent = rebuiltComponent.append(c);
                    commandSender.sendMessage(c);
                }
                commandSender.sendMessage("rebuilt component: ");
                commandSender.sendMessage(rebuiltComponent);

Result: https://i.gyazo.com/c56bdee7ce3d1dc5687f0cceafb2db34.png

Expected result was for the rebuiltComponent to be re-assembled the same as component

paper:

This server is running Paper version git-Paper-399 (MC: 1.17.1) (Implementing API version 1.17.1-R0.1-SNAPSHOT) (Git: d4318a6 on ver/1.17.1)
You are 10 version(s) behind
Download the new version at: https://papermc.io/downloads
Previous version: git-Paper-388 (MC: 1.17.1)

Thank you

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kezzcommented, Feb 21, 2022

If you can think of a good way to word this then feel free to submit a PR.

0reactions
jaylawlcommented, Feb 21, 2022

Well, it may be obvious to you, but wasn’t to me - to the point of me hard-crashing my test server and opening an issue. Putting information like that the javadocs would spare people that aren’t as well-versed as y’all a bunch of trouble.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Discovery of the structure of DNA (article) - Khan Academy
DNA nucleotides assemble in chains linked by covalent bonds, which form between the deoxyribose sugar of one nucleotide and the phosphate group of...
Read more >
CH103 – Chapter 8: The Major Macromolecules – Chemistry
(a) This molecule of stearic acid has a long chain of carbon atoms. (b) Glycine, a component of proteins, contains carbon, nitrogen, oxygen,...
Read more >
The Shape and Structure of Proteins - NCBI Bookshelf
The folded structure is stabilized by noncovalent interactions between different parts of the polypeptide chain. The amino acids with hydrophobic side chains ...
Read more >
Lipids - Fatty Acids - MSU chemistry
The common feature of these lipids is that they are all esters of moderate to long chain fatty acids. Acid or base-catalyzed hydrolysis...
Read more >
A Complete Look at How to Assemble a Wedding Invitation Suite
The names of all invited guests should be placed on the front along with the mailing address. Your return address should be placed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found