File tree Expand file tree Collapse file tree
src/main/java/me/rayzr522/jsonmessage Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -431,16 +431,17 @@ public JSONMessage endCenter() {
431431 for (; ; current ++) {
432432 MessagePart part = current < parts .size () ? parts .get (current ) : null ;
433433 String raw = part == null ? null : ChatColor .stripColor (part .toLegacy ());
434+ int rawLength = raw == null ? 0 : raw .length ();
434435
435- if (current >= parts .size () || totalLineLength + raw . length () >= 53 ) {
436+ if (current >= parts .size () || totalLineLength + rawLength >= 53 ) {
436437 int padding = Math .max (0 , (53 - totalLineLength ) / 2 );
437438 currentLine .firstElement ().setText (Strings .repeat (" " , padding ) + currentLine .firstElement ().getText ());
438439 currentLine .lastElement ().setText (currentLine .lastElement ().getText () + "\n " );
439440 currentLine .clear ();
440441 break ;
441442 }
442443
443- totalLineLength += raw . length () ;
444+ totalLineLength += rawLength ;
444445 currentLine .add (part );
445446 }
446447 }
You can’t perform that action at this time.
0 commit comments