package land.chipmunk.chipmunkmod.util;

import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.ComponentContents;
import net.minecraft.network.chat.contents.PlainTextContents;

public class ComponentUtilities {
    public static String plainOrNull (final Component text) {
        final ComponentContents content = text.getContents();
        if (!(content instanceof final PlainTextContents plainContent)) return null;

        return plainContent.text();
    }
}
