commodore-file

The commodore file format

License

License

MIT
GroupId

GroupId

me.lucko
ArtifactId

ArtifactId

commodore-file
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

jar
Description

Description

commodore-file
The commodore file format
Project URL

Project URL

https://github.com/lucko/commodore-file
Source Code Management

Source Code Management

https://github.com/lucko/commodore-file

Download commodore-file

How to add to project

<!-- https://jarcasting.com/artifacts/me.lucko/commodore-file/ -->
<dependency>
    <groupId>me.lucko</groupId>
    <artifactId>commodore-file</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/me.lucko/commodore-file/
implementation 'me.lucko:commodore-file:1.0'
// https://jarcasting.com/artifacts/me.lucko/commodore-file/
implementation ("me.lucko:commodore-file:1.0")
'me.lucko:commodore-file:jar:1.0'
<dependency org="me.lucko" name="commodore-file" rev="1.0">
  <artifact name="commodore-file" type="jar" />
</dependency>
@Grapes(
@Grab(group='me.lucko', module='commodore-file', version='1.0')
)
libraryDependencies += "me.lucko" % "commodore-file" % "1.0"
[me.lucko/commodore-file "1.0"]

Dependencies

compile (1)

Group / Artifact Type Version
com.mojang » brigadier jar 1.0.17

Project Modules

There are no modules declared in this project.

commodore-file Javadocs Maven Central

The commodore file format is a simplified way of representing Brigadier command node trees in a string form.

This repository is a Java parser for the format.

Example

Below is an example commodore file for Minecraft's /time command:

time {
  set {
    day;
    noon;
    night;
    midnight;
    time brigadier:integer;
  }
  add {
    time brigadier:integer;
  }
  query {
    daytime;
    gametime;
    day;
  }
}

To parse to a brigadier CommandNode:

LiteralCommandNode<Sender> timeCommand = CommodoreFileReader.INSTANCE.parse(new File("time.commodore"));

This will return a command node equivalent to the following node as build with brigadier's API.

LiteralCommandNode<Sender> timeCommand = LiteralArgumentBuilder.literal("time")
        .then(LiteralArgumentBuilder.literal("set")
                .then(LiteralArgumentBuilder.literal("day"))
                .then(LiteralArgumentBuilder.literal("noon"))
                .then(LiteralArgumentBuilder.literal("night"))
                .then(LiteralArgumentBuilder.literal("midnight"))
                .then(RequiredArgumentBuilder.argument("time", IntegerArgumentType.integer())))
        .then(LiteralArgumentBuilder.literal("add")
                .then(RequiredArgumentBuilder.argument("time", IntegerArgumentType.integer())))
        .then(LiteralArgumentBuilder.literal("query")
                .then(LiteralArgumentBuilder.literal("daytime"))
                .then(LiteralArgumentBuilder.literal("gametime"))
                .then(LiteralArgumentBuilder.literal("day"))
        ).build();

Versions

Version
1.0