-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Possible unintentional functionality with "formatless" strings #3623
Comments
i think you probably right |
Janmm14
added a commit
to Janmm14/BungeeCord
that referenced
this issue
Feb 27, 2024
… converting to legacy. In Tests: Add static ChatColor import, replace all usages of '§' with ChatColor.
Janmm14
added a commit
to Janmm14/BungeeCord
that referenced
this issue
Feb 27, 2024
… converting to legacy. In Tests: Add static ChatColor import, replace all usages of '§' with ChatColor. Co-authored-by: bob7l <[email protected]>
Janmm14
added a commit
to Janmm14/BungeeCord
that referenced
this issue
Feb 27, 2024
… converting to legacy. In Tests: Add static ChatColor import, replace all usages of '§' with ChatColor. Co-authored-by: bob7l <[email protected]>
Janmm14
added a commit
to Janmm14/BungeeCord
that referenced
this issue
Apr 14, 2024
… converting to legacy. In Tests: Add static ChatColor import, replace all usages of '§' with ChatColor. Co-authored-by: bob7l <[email protected]> # Conflicts: # chat/src/test/java/net/md_5/bungee/api/chat/ComponentsTest.java # chat/src/test/java/net/md_5/bungee/api/chat/TranslatableComponentTest.java
This implementation causes wrong results of |
Janmm14
added a commit
to Janmm14/BungeeCord
that referenced
this issue
Apr 21, 2024
… converting to legacy. In Tests: - add bunch of tests including a failing test - change expected results as unneccessary white color codes got less Co-authored-by: bob7l <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
The text was updated successfully, but these errors were encountered: