A cross-platform wrapper library for making Brigadier commands
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
William 785b33e845
feat: make x-plat command registering possible
5 months ago
.github feat: make x-plat command registering possible 5 months ago
common feat: make x-plat command registering possible 5 months ago
example-plugin feat: make x-plat command registering possible 5 months ago
fabric-1.20.1 feat: make x-plat command registering possible 5 months ago
fabric-1.20.6 feat: make x-plat command registering possible 5 months ago
gradle/wrapper refactor: redo layout, registration structure 6 months ago
images build: add CI, README, banner, metadata 6 months ago
paper feat: make x-plat command registering possible 5 months ago
velocity feat: make x-plat command registering possible 5 months ago
.gitignore refactor: redo layout, registration structure 6 months ago
HEADER refactor: redo layout, registration structure 6 months ago
LICENSE Initial commit 7 months ago
README.md feat: make x-plat command registering possible 5 months ago
build.gradle feat: make x-plat command registering possible 5 months ago
gradle.properties refactor: redo layout, registration structure 6 months ago
gradlew refactor: redo layout, registration structure 6 months ago
gradlew.bat refactor: redo layout, registration structure 6 months ago
settings.gradle feat: make x-plat command registering possible 5 months ago

README.md

Claim Operations Library


Uniform is cross-platform wrapper for making Brigadier commands, based on BrigadierWrapper by Tofaa2, which itself was inspired by EmortalMC's command-system.

Uniform currently targets the following platforms, (in addition to uniform-common which you can compile against in multi-platform plugins):

Platform Artifact Minecraft Java
Paper uniform-paper >1.20.4 >17
Velocity uniform-velocity >3.3.0 >17
Fabric 1.20.1 uniform-fabric-1.20.1 =1.20.1 >17
Fabric 1.20.6 uniform-fabric-1.20.6 =1.20.6 >21

Uniform plans to support the following platforms:

Platform Version Java
Spigot† >1.17.1 >17

† Brigadier commands are wrapped into non-brigadier Bukkit plugin commands for legacy Spigot support.

Using

Platform-specific commands

Extend the platform-specific PlatformCommand class and implement the execute method.

public class ExampleCommand extends PaperCommand {

    public ExampleCommand() {
        super("example", "platform-specific");
        addSyntax((context) -> {
            context.getSource().getBukkitSender().sendMessage("Woah!!!!");
            String arg = context.getArgument("message", String.class);
            context.getSource().getBukkitSender().sendMessage(MiniMessage.miniMessage().deserialize(arg));
        }, stringArg("message"));
    }

}

Cross-platform commands

Target uniform-common and implement the Command class.

public class ExampleCrossPlatCommand implements Command {

    @Override
    @NotNull
    public String getNamespace() {
        return "example";
    }

    @Override
    @NotNull
    public List<String> getAliases() {
        return List.of("cross-plat");
    }

    @Override
    public <S> void provide(@NotNull BaseCommand<S> command) {
        command.setCondition(source -> true);
        command.setDefaultExecutor((ctx) -> {
            // Use command.getUser(ctx.getSource()) to get the user
            final Audience user = command.getUser(ctx.getSource()).getAudience();
            user.sendMessage(Component.text("Hello, world!"));
        });
    }

}

Setup

Uniform is available on Maven. You can browse the Javadocs here.

Gradle setup instructions

First, add the Maven repository to your build.gradle file:

repositories {
    maven { url "https://repo.william278.net/releases" }
}

Then, add the dependency itself. Replace VERSION with the latest release version. (e.g., 1.0) and PLATFORM with the platform you are targeting (e.g., paper). If you want to target pre-release "snapshot" versions (not recommended), you should use the /snapshots repository instead.

dependencies {
    implementation "net.william278.uniform:uniform-PLATFORM:VERSION"
}

Using Maven/something else? There's instructions on how to include Uniform on the repo browser.

Building

To build Uniform, run clean build in the root directory. The output JARs will be in target/.

License

Uniform is licensed under GPL v3 as it derives from BrigadierWrapper. See LICENSE for more information.