Command framework & dispatcher for the JVM
Find a file
2020-09-21 19:51:17 +02:00
.github Remove CodeQL workflow 2020-09-13 14:13:43 +02:00
.mvn/wrapper Clean up generics (and get rid of the type parameter for command meta data) 2020-09-19 12:14:09 +02:00
cloud-annotations Allow argument descriptions to be set using the @Argument annotation 2020-09-21 19:51:17 +02:00
cloud-core Minor improvements to the help system 2020-09-21 19:29:15 +02:00
cloud-jline Attempt to fix maven thing again yes 2020-09-20 21:13:09 +02:00
cloud-minecraft Allow argument descriptions to be set using the @Argument annotation 2020-09-21 19:51:17 +02:00
cloud-pipeline@b84f41bd9d Update submodule 2020-09-12 14:43:48 +02:00
icons this work? 2020-09-11 08:33:35 +02:00
.editorconfig Add limited support for completions, add .editorconfig and reformat. 2020-09-06 16:13:08 +02:00
.gitignore Initial commit 2020-08-30 20:53:00 +02:00
.gitmodules Fix pipeline submodule 2020-09-12 14:33:22 +02:00
build.sh Update build.sh 2020-09-12 19:31:36 +02:00
checkstyle.xml Add Brigadier support. 2020-09-14 22:37:06 +02:00
cloud_logo.png Add files via upload 2020-09-08 11:10:05 +02:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2020-09-11 21:06:14 +02:00
CONTRIBUTING.md Create CONTRIBUTING.md 2020-09-11 21:05:16 +02:00
LICENSE Update README and change copyright holder in license 2020-09-11 08:56:26 +02:00
mvnw Add maven wrapper 2020-09-12 19:25:55 +02:00
mvnw.cmd Add maven wrapper 2020-09-12 19:25:55 +02:00
pom.xml Add adventure based help menu 2020-09-21 19:11:48 +02:00
README.md Add preview examples 2020-09-21 09:24:38 +02:00

cloud command framework license build CodeFactor

This is going to be a general-purpose Java command dispatcher & framework.
It will allow programmers to define command chains that users can use to execute pre-defined actions.

The library was named cloud because using it makes you feel like you're floating around on a cloud in heaven. It's an experience of pure bliss and joy.
This is unlike the experience of using any command framework that currently exists for the JVM, which can be compared to drowning in a pool of lava while watching your family get eaten by a pack of wolves.

Its feature set is derived from already existing command frameworks, while being less restrictive, opinionated and confusing.
CLOUD is built to be completely deterministic and your commands will behave exactly as you've programmed them to. No fluff and no mess, just a smooth cloud-like experience.

The code is based on a paper that can be found here.

goals

  • Allow for commands to be defined using builder patterns (Done)
  • Allow for commands to be defined using annotated methods (Done)
  • Allow for command pre-processing (Done)
  • Allow for command suggestion outputs (Done)

The builders will look something like:

mgr.command(mgr.commandBuilder("give")
               .withSenderType(Player.class)
               .argument(EnumArgument.required(Material.class, "material"))
               .argument(IntegerArgument.required("amount"))
               .handler(c -> {
                   final Material material = c.getRequired("material");
                   final int amount = c.getRequired("amount");
                   final ItemStack itemStack = new ItemStack(material, amount);
                   ((Player) c.getSender()).getInventory().addItem(itemStack);
                   c.getSender().sendMessage("You've been given stuff, bro.");
               })
               .build())

and the annotated methods will look something like:

@Description("Test cloud command using @CommandMethod")
@CommandMethod(value = "annotation|a <input> [number]", permission = "some.permission.node")
private void annotatedCommand(@Nonnull final Player player,
                              @Argument("input") @Completions("one,two,duck") @Nonnull final String input,
                              @Argument(value = "number", defaultValue = "5") @Range(min = "10", max = "100")
                                  final int number) {
    player.sendMessage(ChatColor.GOLD + "Your input was: " + ChatColor.AQUA + input + ChatColor.GREEN + " (" + number + ")");
}

Once the core functionality is present, the framework will offer implementation modules, supporting a wide variety of platforms.

implementations

  • Minecraft:

    • Generic Brigadier module (Done)
    • Bukkit module (Done)
    • Paper module, with optional Brigadier support (Done)
    • Sponge module
    • Cloudburst
    • Bungee module (Done)
    • Velocity module (Done)
  • Create a Discord implementation (JDA)

  • Create a Java CLI implementation (JLine3)

nomenclature

  • sender: someone who is able to produce input
  • argument: an argument is something that can be parsed from a string
  • required argument: a required argument is an argument that must be provided by the sender
  • optional argument: an optional argument is an argument that can be omitted (may have a default value)
  • static argument: a string literal
  • command: a command is a chain of arguments and a handler that acts on the parsed arguments
  • command tree: structure that contains all commands and is used to parse input into arguments

modules

  • cloud-core: Core module containing most of the cloud API, and shared implementations
  • cloud-annotations: Annotation processing code that allows you to use annotated methods rather than builders
  • cloud-jline: W.I.P JLine3 implementation of cloud
  • cloud-minecraft/cloud-brigadier: Brigadier mappings for cloud
  • cloud-minecraft/cloud-bukkit: Bukkit 1.8.8+ implementation of cloud
  • cloud-minecraft/cloud-paper: Module that extends cloud-bukkit to add special support for Paper 1.8.8+
  • cloud-minecraft/cloud-bungee: BungeeCord 1.8.8+ implementation of Cloud
  • cloud-minecraft/cloud-velocity: Velocity v1.1.0 implementation of cloud

develop & build

To clone the repository, use git clone --recursive https://github.com/Sauilitired/cloud.git.
To then build it, use mvn clean package. If you've already cloned the repository without
doing it recursively, use git submodule update --remote to update the submodule. This is
only needed the first time, as Maven will perform this operation when building.

There is a bash script (build.sh) that performs the submodule updating & builds the project.
Feel free to use this if you want to.

use

To use cloud you will first need to add it as a dependency to your project. Cloud is available from IntellectualSites' maven repository.

maven:

<repository>  
 <id>intellectualsites-snapshots</id>  
 <url>https://mvn.intellectualsites.com/content/repositories/snapshots</url>  
</repository>  
<dependency>  
 <groupId>com.intellectualsites</groupId>  
 <artifactId>cloud-PLATFORM</artifactId>
 <version>0.1.0-SNAPSHOT</version>
</dependency>
<!-- 
~    Optional: Allows you to use annotated methods
~    to declare commands 
-->
<dependency>  
 <groupId>com.intellectualsites</groupId>  
 <artifactId>cloud-annotations</artifactId>
 <version>0.1.0-SNAPSHOT</version>
</dependency>

gradle:

repositories {
    maven { url = 'https://mvn.intellectualsites.com/content/repositories/snapshots' }
}
dependencies {
    implementation 'com.intellectualsites:cloud-PLATFORM:0.1.0-SNAPSHOT'
}

Replace PLATFORM with your platform of choice. We currently support: bukkit, paper, bungee and velocity. All modules use the same versions. More information about the Minecraft specific modules can be found here.

This library is licensed under the MIT license, and the code copyright belongs to Alexander Söderberg. The implementation is based on a paper written by the copyright holder, and this paper exists under the CC Attribution 4 license.

The Cloud icon was created by by Thanga Vignesh P on Iconscout and Digital rights were purchased under a premium plan.