Skip to content

Commit

Permalink
fix char length
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei1058 committed Nov 26, 2022
1 parent d4a03d6 commit fcd9762
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public void setContent(@NotNull String content) {
this.prefix = content.substring(0, 16);
if (this.prefix.charAt(15) == ChatColor.COLOR_CHAR) {
this.prefix = content.substring(0, 15);
setSuffix(content.substring(16));
setSuffix(content.substring(15));
} else {
setSuffix(content.substring(16));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,13 @@ public void setContent(@NotNull String content) {
if (!getReceivers().isEmpty()) {
content = SidebarManager.getInstance().getPapiSupport().replacePlaceholders(getReceivers().get(0), content);
}
if (content.length() > 16) {
this.prefix = content.substring(0, 16);
if (this.prefix.charAt(15) == ChatColor.COLOR_CHAR) {
this.prefix = content.substring(0, 15);
setSuffix(content.substring(15));
if (content.length() > 64) {
this.prefix = content.substring(0, 64);
if (this.prefix.charAt(63) == ChatColor.COLOR_CHAR) {
this.prefix = content.substring(0, 63);
setSuffix(content.substring(63));
} else {
setSuffix(content.substring(16));
setSuffix(content.substring(64));
}
} else {
this.prefix = content;
Expand All @@ -248,7 +248,7 @@ public void setSuffix(@NotNull String secondPart) {
return;
}
secondPart = ChatColor.getLastColors(this.prefix) + secondPart;
this.suffix = secondPart.length() > 16 ? secondPart.substring(0, 16) : secondPart;
this.suffix = secondPart.length() > 64 ? secondPart.substring(0, 64) : secondPart;
}

public void sendUpdateToAllReceivers() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public void setContent(@NotNull String content) {
}
if (content.length() > 32) {
this.prefix = content.substring(0, 32);
if (this.prefix.charAt(15) == ChatColor.COLOR_CHAR) {
if (this.prefix.charAt(31) == ChatColor.COLOR_CHAR) {
this.prefix = content.substring(0, 31);
setSuffix(content.substring(31));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public void setContent(@NotNull String content) {
}
if (content.length() > 32) {
this.prefix = content.substring(0, 32);
if (this.prefix.charAt(15) == ChatColor.COLOR_CHAR) {
if (this.prefix.charAt(31) == ChatColor.COLOR_CHAR) {
this.prefix = content.substring(0, 31);
setSuffix(content.substring(31));
} else {
Expand Down

0 comments on commit fcd9762

Please sign in to comment.