File tree Expand file tree Collapse file tree
patch/adventure-text-serializer-legacy/src/main/java/net/kyori/adventure/text/serializer/legacy Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -274,14 +274,14 @@ private TextComponent extractUrl(final TextComponent component) {
274274 return state .toString ();
275275 }
276276
277- private static boolean applyFormat (final TextComponent .@ NotNull Builder builder , final @ NotNull TextFormat format ) {
277+ private static boolean applyFormat (final TextComponent .@ NotNull Builder builder , final @ Nullable TextFormat format ) { // packetevents patch
278278 if (format instanceof TextColor ) {
279279 builder .colorIfAbsent ((TextColor ) format );
280280 return true ;
281281 } else if (format instanceof TextDecoration ) {
282282 builder .decoration ((TextDecoration ) format , TextDecoration .State .TRUE );
283283 return false ;
284- } else if (format instanceof Reset ) {
284+ } else if (format == null || format instanceof Reset ) { // packetevents patch
285285 return true ;
286286 }
287287 throw new IllegalArgumentException (String .format ("unknown format '%s'" , format .getClass ()));
@@ -558,12 +558,9 @@ enum FormatCodeType {
558558
559559 static final class DecodedFormat {
560560 final FormatCodeType encodedFormat ;
561- final TextFormat format ;
561+ final @ Nullable TextFormat format ; // packetevents patch
562562
563- private DecodedFormat (final FormatCodeType encodedFormat , final TextFormat format ) {
564- if (format == null ) {
565- throw new IllegalStateException ("No format found" );
566- }
563+ private DecodedFormat (final FormatCodeType encodedFormat , final @ Nullable TextFormat format ) { // packetevents patch
567564 this .encodedFormat = encodedFormat ;
568565 this .format = format ;
569566 }
You can’t perform that action at this time.
0 commit comments