Class CommodoreFileFormat


  • public final class CommodoreFileFormat
    extends Object
    The '.commodore' file format is a simplified way of representing Brigadier command node trees in a string form.

    This class provides a means to parse these files into real CommandNodes.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static me.lucko.commodore.file.CommodoreFileReader READER  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <S> com.mojang.brigadier.tree.LiteralCommandNode<S> parse​(File file)
      Parses a LiteralCommandNode from a commodore file.
      static <S> com.mojang.brigadier.tree.LiteralCommandNode<S> parse​(InputStream inputStream)
      Parses a LiteralCommandNode from a commodore file.
      static <S> com.mojang.brigadier.tree.LiteralCommandNode<S> parse​(Reader reader)
      Parses a LiteralCommandNode from a commodore file.
      static <S> com.mojang.brigadier.tree.LiteralCommandNode<S> parse​(Path path)
      Parses a LiteralCommandNode from a commodore file.
    • Field Detail

      • READER

        public static final me.lucko.commodore.file.CommodoreFileReader READER
    • Method Detail

      • parse

        public static <S> com.mojang.brigadier.tree.LiteralCommandNode<S> parse​(Reader reader)
                                                                         throws IOException
        Parses a LiteralCommandNode from a commodore file.
        Type Parameters:
        S - the command node sender type
        Parameters:
        reader - a reader for the file
        Returns:
        the command node
        Throws:
        IOException - if an error occurs whilst reading the file
        RuntimeException - if an error occurs whilst lexing or parsing the file
        See Also:
        CommodoreFileReader.parse(Reader)
      • parse

        public static <S> com.mojang.brigadier.tree.LiteralCommandNode<S> parse​(InputStream inputStream)
                                                                         throws IOException
        Parses a LiteralCommandNode from a commodore file.
        Type Parameters:
        S - the command node sender type
        Parameters:
        inputStream - an inputStream for the file
        Returns:
        the command node
        Throws:
        IOException - if an error occurs whilst reading the file
        RuntimeException - if an error occurs whilst lexing or parsing the file
        See Also:
        CommodoreFileReader.parse(InputStream)
      • parse

        public static <S> com.mojang.brigadier.tree.LiteralCommandNode<S> parse​(Path path)
                                                                         throws IOException
        Parses a LiteralCommandNode from a commodore file.
        Type Parameters:
        S - the command node sender type
        Parameters:
        path - the path to the file
        Returns:
        the command node
        Throws:
        IOException - if an error occurs whilst reading the file
        RuntimeException - if an error occurs whilst lexing or parsing the file
        See Also:
        CommodoreFileReader.parse(Path)
      • parse

        public static <S> com.mojang.brigadier.tree.LiteralCommandNode<S> parse​(File file)
                                                                         throws IOException
        Parses a LiteralCommandNode from a commodore file.
        Type Parameters:
        S - the command node sender type
        Parameters:
        file - the file
        Returns:
        the command node
        Throws:
        IOException - if an error occurs whilst reading the file
        RuntimeException - if an error occurs whilst lexing or parsing the file
        See Also:
        CommodoreFileReader.parse(File)