File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
src/main/java/me/rayzr522/jsonmessage Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -431,16 +431,17 @@ public JSONMessage endCenter() {
431
431
for (; ; current ++) {
432
432
MessagePart part = current < parts .size () ? parts .get (current ) : null ;
433
433
String raw = part == null ? null : ChatColor .stripColor (part .toLegacy ());
434
+ int rawLength = raw == null ? 0 : raw .length ();
434
435
435
- if (current >= parts .size () || totalLineLength + raw . length () >= 53 ) {
436
+ if (current >= parts .size () || totalLineLength + rawLength >= 53 ) {
436
437
int padding = Math .max (0 , (53 - totalLineLength ) / 2 );
437
438
currentLine .firstElement ().setText (Strings .repeat (" " , padding ) + currentLine .firstElement ().getText ());
438
439
currentLine .lastElement ().setText (currentLine .lastElement ().getText () + "\n " );
439
440
currentLine .clear ();
440
441
break ;
441
442
}
442
443
443
- totalLineLength += raw . length () ;
444
+ totalLineLength += rawLength ;
444
445
currentLine .add (part );
445
446
}
446
447
}
You can’t perform that action at this time.
0 commit comments