Skip to content

Possible unintentional functionality with "formatless" strings #3623

Open
@bob7l

Description

Bungeecord version

BungeeCord-Proxy 1.20-R0.3-SNAPSHOT ( build 1800)

Server version

No response

Client version

1.8, 1.20.2

Bungeecord plugins

None

The bug

Not sure if this is intended behavior, but if we readBaseComponent a String which has no format (example: 'asdasd'), the string will be given a default white color.

Upon being converted back to legacy text through toLegacyText(), the string will now contain the white format symbols at the beginning of the string therefor incrementing it's original length by 2

I managed to "fix" this by simply adding this check to verify the component actually has a set color:

void addFormat(StringBuilder builder)
{
if (!(!style.hasColor() && parent == null))
builder.append(getColor());

At BaseComponent's addFormat function

Log output (links)

No response

Checking

  • I am using BungeeCord and not a fork. Issues with forks should not be reported here.
  • I think this is not an issue with a bungeecord plugin.
  • I have not read these checkboxes and therefore I just ticked them all.
  • This is not a question or plugin creation help request.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions