explaingit

mojang/brigadier

Analysis updated 2026-07-03

3,688JavaAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

Brigadier is Mojang's open-source Java library for parsing and dispatching commands using a tree structure, originally built for Minecraft and now available for any JVM project that needs typed command parsing with autocomplete hints.

Mindmap

mindmap
  root((Brigadier))
    What it does
      Parses typed commands
      Dispatches to handlers
      Tree-based command structure
    Features
      Built-in argument types
      Custom argument types
      Autocomplete generation
      Error messages
    Use Cases
      Game command systems
      CLI parsing
      Chat bot commands
    Tech Stack
      Java
      Maven or Gradle
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a Minecraft plugin command system where /give player item 5 routes to a different handler than /give player item.

USE CASE 2

Add a typed command parser to a Java CLI tool or chat bot that validates argument types and gives users clear error messages.

USE CASE 3

Generate autocomplete suggestions for a command interface by querying Brigadier's usage tree at any node.

What is it built with?

JavaMavenGradle

How does it compare?

mojang/brigadiertng/archunitoasisfeng/island
Stars3,6883,6903,685
LanguageJavaJavaJava
Setup difficultyeasyeasyhard
Complexity2/52/54/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Add via Maven or Gradle from Mojang's public repository, no external infra or API keys required.

MIT License, use freely for any purpose, including commercial use, with no restrictions beyond keeping the copyright notice.

In plain English

Brigadier is a command parsing and dispatching library built by Mojang, the company behind Minecraft. It was originally created for Minecraft: Java Edition and later released as a standalone open-source library available to any Java or JVM project under the MIT license. The core idea is that you define a tree of possible command structures, and when a user types something, the library figures out which branch of that tree matches what they typed, validates any arguments, and calls the appropriate function. You build this tree by registering commands one at a time. Each command can be a fixed keyword, an argument that accepts a specific type of value like an integer, or a combination where a keyword is followed by one or more arguments. The README shows an example where typing "foo" runs one piece of code and typing "foo 123" runs a different piece. Argument types handle the parsing and validation. The library includes some built-in types, and you can write your own if you need a custom format. When parsing fails because the user typed something the library cannot understand, it throws a specific exception type that describes what went wrong, which makes it straightforward to show the user a helpful error message. For usage hints, the library can generate a list of all valid command patterns under any node in the tree, or a condensed "smart usage" summary that groups optional parts together. These are designed to be shown to users as autocomplete suggestions or help text. The library is available through Maven and Gradle via Mojang's public repository. Contributions are welcome but require a Contributor License Agreement, and the project follows Microsoft's open-source code of conduct.

Copy-paste prompts

Prompt 1
Using Mojang's Brigadier library in Java, show me how to register a command 'teleport' that takes a player name string and an integer distance, then dispatches to a handler function.
Prompt 2
How do I create a custom argument type in Brigadier that parses a 'HH:MM' time string and throws a CommandSyntaxException if the format is wrong?
Prompt 3
Using Brigadier, show me how to generate autocomplete suggestions for a command tree so users see valid options as they type in a chat box.

Frequently asked questions

What is brigadier?

Brigadier is Mojang's open-source Java library for parsing and dispatching commands using a tree structure, originally built for Minecraft and now available for any JVM project that needs typed command parsing with autocomplete hints.

What language is brigadier written in?

Mainly Java. The stack also includes Java, Maven, Gradle.

What license does brigadier use?

MIT License, use freely for any purpose, including commercial use, with no restrictions beyond keeping the copyright notice.

How hard is brigadier to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is brigadier for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub mojang on gitmyhub

Verify against the repo before relying on details.