JorelAli / CommandAPI

A Bukkit/Spigot API for the command UI introduced in Minecraft 1.13

Home Page:https://commandapi.jorel.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


CommandAPI logo

A Bukkit/Spigot API to use the command UI introduced in Minecraft 1.13

GitHub Maven Central Join us on Discord
CodeFactor GitHub Workflow Status (master) GitHub Workflow Status (dev/dev) Spiget Download Size
Spiget Downloads GitHub all releases Modrinth Downloads

Support and Project Discussion:

Downloads & Documentation:

Other

Compatible Minecraft versions:

The list of what version of the CommandAPI you'll need to run on a specific version of Minecraft is as follows:

Minecraft version Compatible versions Latest compatible
version
Minimum Java
version required
to run latest version
1.13.x v1.0 - 5.12, 8.3.0 - 8.8.0 8.8.0 16
1.14.1, 1.14.2 v2.0 - 5.12, 8.3.0 - 8.8.0 8.8.0 16
1.14.3, 1.14.4 v2.1 - 5.12, 8.3.0 - 8.8.0 8.8.0 16
1.15.x v2.3a - 5.12, 8.3.0 - 9.3.0 9.3.0 16
1.16.1 v3.0 - 5.12, 8.3.0 - 9.3.0 9.3.0 16
1.16.2 v4.0 - 5.12, 8.3.0 - 9.3.0 9.3.0 16
1.16.3 v4.2 - 5.12, 8.3.0 - 9.3.0 9.3.0 16
1.16.4 v5.2 - 5.12, 8.3.0 - 9.3.0 9.3.0 16
1.16.5 v5.7 - 7.0.0, 8.3.0 - 9.3.0 9.3.0 16
1.17 6.0.x - 9.3.0 9.3.0 16
1.17.1 6.1.x - 9.3.0 9.3.0 16
1.18, 1.18.1 6.5.2 - 9.3.0 9.3.0 16
1.18.2 6.5.4 - 9.3.0 9.3.0 16
1.19 8.3.0 - 9.3.0 9.3.0 16
1.19.1 8.5.0 - 9.3.0 9.3.0 16
1.19.2 8.5.1 - 9.3.0 9.3.0 16
1.19.3 8.7.0 - 9.3.0 9.3.0 16
1.19.4 8.8.0 - 9.3.0 9.3.0 16
1.20 9.0.2 - 9.3.0 9.3.0 16
1.20.1 9.0.3 - 9.3.0 9.3.0 16
1.20.2 9.2.0 - 9.3.0 9.3.0 16
1.20.3, 1.20.4 9.3.0 9.3.0 16

Purpose

This project provides an API to help Bukkit/Spigot developers use the Minecraft 1.13 command UI, which includes:

  • Better commands - Prevent players from running invalid commands, making it easier for developers - you won't get dodgy input!

    better commands

  • Better arguments - Choose from over 50 arguments including location arguments, raw JSON, enchantments, lists, particles... all fully supported with built-in error checking!

    better arguments

  • Support for proxied command senders - Run your command as other entities using /execute as ... run command

    proxied senders

  • Argument tooltips - Let your users know exactly what their command will do using argument tooltips

    argument tooltips

  • Support for the /execute command - Let your command to be executed by the built in /execute command, as well as command blocks!

  • Support for Minecraft's functions - Allow your command to be executed from Minecraft's functions and tags

  • No plugin.yml registration - Commands don't need to be registered in the plugin.yml file anymore

  • No need for Brigadier - You don't need to import Brigadier in your projects to use the CommandAPI

  • No tracking - The CommandAPI doesn't collect any stats about its plugin; what you see is what you get!

Still not convinced? In addition to all of the above, the CommandAPI also provides:

  • Built-in command converter - Convert other plugin commands into /execute-compatible ones - no code required!
  • Tree-structure command registration - Like Brigadier's code format? We've got you covered with CommandTree
  • Kotlin DSL - Prefer writing plugins in Kotlin? The CommandAPI has an optional Kotlin DSL just for you
  • Powerful suggestion generation - Generate new suggestions for each argument, or add to existing suggestions
  • Safe suggestion generation - The CommandAPI offers compile-time type safety for specific arguments
  • Precise permission support - Apply permissions to specific arguments - you need perms to even see the argument
  • Fast updates - Consistently supports new Minecraft versions within a week of their release
  • Insanely detailed documentation - Trust me, you've never seen a plugin documentation look so good.

Code examples

Simple command registration
new CommandAPICommand("enchantitem")
    .withArguments(new EnchantmentArgument("enchantment"))
    .withArguments(new IntegerArgument("level", 1, 5))
    .executesPlayer((player, args) -> {
        Enchantment enchantment = (Enchantment) args.get("enchantment");
        int level = (int) args.get("level");
        
        //Add the enchantment
        player.getInventory().getItemInMainHand().addEnchantment(enchantment, level);
    })
    .register();
Potion removing, suggesting potions that a player has currently
List<Argument<?>> arguments = new ArrayList<>();
arguments.add(new EntitySelectorArgument.OnePlayer("target"));
arguments.add(new PotionEffectArgument("potioneffect").replaceSafeSuggestions(SafeSuggestions.suggest(info -> {
    Player target = (Player) info.previousArgs().get("target");

    //Convert PotionEffect[] into PotionEffectType[]
    return target.getActivePotionEffects().stream()
            .map(PotionEffect::getType)
            .toList().toArray(new PotionEffectType[0]);
})));

new CommandAPICommand("removeeffect")
    .withArguments(arguments)
    .executesPlayer((sender, args) -> {
        Player player = (Player) args.get("target");
        PotionEffectType effect = (PotionEffectType) args.get("potioneffect");
        player.removePotionEffect(effect);
    })
    .register();
Subcommands
new CommandAPICommand("perm")
    .withSubcommand(new CommandAPICommand("group")
        .withSubcommand(new CommandAPICommand("add")
            .withArguments(new StringArgument("permission"))
            .withArguments(new StringArgument("groupName"))
            .executes((sender, args) -> {
                //perm group add code
            })
        )
        .withSubcommand(new CommandAPICommand("remove")
            .withArguments(new StringArgument("permission"))
            .withArguments(new StringArgument("groupName"))
            .executes((sender, args) -> {
                //perm group remove code
            })
        )
    )
    .withSubcommand(new CommandAPICommand("user")
        .withSubcommand(new CommandAPICommand("add")
            .withArguments(new StringArgument("permission"))
            .withArguments(new StringArgument("userName"))
            .executes((sender, args) -> {
                //perm user add code
            })
        )
        .withSubcommand(new CommandAPICommand("remove")
            .withArguments(new StringArgument("permission"))
            .withArguments(new StringArgument("userName"))
            .executes((sender, args) -> {
                //perm user remove code
            })
        )
    )
    .register();
Command trees
new CommandTree("perm")
    .then(new MultiLiteralArgument("group", "user")
        .then(new MultiLiteralArgument("add", "remove")
            .then(new StringArgument("permission")
                .then(new StringArgument("groupName")
                    .executes((sender, args) -> {
                        // args = ["group" or "user", "add" or "remove", permission, groupName]
                    })
                )
            )
        )
    )
    .register();
Annotation-based commands
@Command("warp")
public class WarpCommand {
    
    // List of warp names and their locations
    static Map<String, Location> warps = new HashMap<>();
    
    @Default
    public static void warp(CommandSender sender) {
        sender.sendMessage("--- Warp help ---");
        sender.sendMessage("/warp - Show this help");
        sender.sendMessage("/warp <warp> - Teleport to <warp>");
        sender.sendMessage("/warp create <warpname> - Creates a warp at your current location");
    }
    
    @Default
    public static void warp(Player player, @AStringArgument String warpName) {
        player.teleport(warps.get(warpName));
    }
    
    @Subcommand("create")
    @Permission("warps.create")
    public static void createWarp(Player player, @AStringArgument String warpName) {
        warps.put(warpName, player.getLocation());
    }
    
}
Kotlin DSL
CommandAPICommand
commandAPICommand("mute") {
    playerArgument("target")
    integerArgument("duration")
    playerExecutor { player, args ->
        val target: Player = args["target"]!!
        val duration: Int = args["duration"]!!
        // Implementation...
    }
}
CommandTree
commandTree("mute") {
    playerArgument("target") {
        integerArgument("duration") {
            playerExecutor { player, args ->
                val target: Player = args["target"]!!
                val duration: Int = args["duration"]!!
            }
        }
        playerExecutor { player, args -> 
            val target: Player = args["target"]!!
            // Some default duration
            // Implementation...
        }
    }
}
Command conversion (no compilation required)
plugins-to-convert:
  - Essentials:
    - speed <speed>[0..10]
    - speed <target>[minecraft:game_profile]
    - speed (walk|fly) <speed>[0..10]
    - speed (walk|fly) <speed>[0..10] <target>[minecraft:game_profile]

Dependencies

Bukkit plugin (shaded) dependencies:


Building the CommandAPI

The CommandAPI is built using the Maven build tool - if you don't have it, you can download it here.

  • Clone the repository using your preferred method, or with the command below:

    git clone https://github.com/JorelAli/CommandAPI.git
  • Run mvn clean install -P Platform.Bukkit

The resulting plugin .jar is found in commandapi-platforms/commandapi-bukkit/commandapi-bukkit-plugin/target/CommandAPI-X.X.X_DATE.jar

Building the CommandAPI's documentation

The CommandAPI's documentation is built using a custom version of mdBook, a command line tool to create "books" with Markdown. This custom version can be found in my mdBook fork.

  • (Optional): Build the CommandAPI first, using the instructions above. The documentation pulls information directly from tests in the source code, so it assumes that those tests compile correctly!

  • Get a copy of mdbook fork executable.

    • On Windows, download mdbook-fa5.exe from the mdBook FA5 support release
    • On Linux:
      • Clone my mdBook fork using your preferred method, or with the command below:

        git clone https://github.com/JorelAli/mdBook.git
      • Use git to checkout to the fa5 branch, using the following command:

        git checkout fa5
      • Build the executable with cargo (can be installed using sudo apt-get install cargo on Ubuntu distros), using the following command:

        cargo build
      • Grab the executable mdbook from mdBook/target/debug/

  • Navigate to the docssrc folder

  • Run mdbook-fa5.exe build (or mdbook build on Linux)

The resulting compiled documentation is found in docs/X.X.X, where X.X.X is specified in the book.toml file's build-dir in the docssrc folder.


CommandAPI Project Timeline

This is the current roadmap for the CommandAPI (as of 11th May 2023):

  • 10.0.0:

    Annotation improvements

    The CommandAPI's annotation system has always been a bit limited and was primarily introduced as a proof-of-concept. In this update, the CommandAPI's annotation system will be improved to be (ideally) as powerful as the non-annotation system and have slightly better type safety, support for non-static methods and better checks to prevent invalid command generation. More information about annotations can be found in the Annotation specification document .

  • Future:

    Velocity support

    Velocity support has been greatly anticipated by a large number of developers and we're hoping to bring Velocity support to you at some point in the future!

    Argument conflict detection

    The CommandAPI simply uses the Brigadier system under the hood. This system is prone to argument conflicts, which is where certain arguments are given priority over other arguments. (For example "hello" and "123" are both valid string arguments, but if you have a command that has a string argument or an integer argument, Brigadier may ignore the integer argument). In this update, the CommandAPI will try to spot potential conflicts and add a warning in the console.

    'True' custom arguments and server-side argument implementations

    Through some brief testing of the regex-mod branch and my MinecraftRegexArgumentMod repository, it was discovered that 'true' custom arguments (arguments with a custom implementation of the returned type and parser) are possible with the aid of a client-sided mod. Additionally, this functionality also works without a client-sided mod, assuming this is only used server-side. This can be useful for server-only datapacks, functions and tags, as well as command blocks. It is possible that this may lead into being ported to Fabric, but there are no concrete plans to do so as of now.


Changelog

Version Date Features / Changes
9.3.0 December 2023 ⚠️ This version has limited support for the FunctionArgument! (See documentation for more information)
  • Adds support for Minecraft 1.20.3 and 1.20.4
  • Fixed bug where calling SimpleFunctionWrapper.getTag() on 1.19+ would throw an error
  • #499 Fix typo in Adventure methods for tooltips
  • Adds ExecutionInfo executors for the Kotlin DSL
  • #497 Adds support for RemoteConsoleCommandSender
  • Fixed executesFeedbackForwarding() not checking for a FeedbackForwardingCommandSender correctly thus allowing every executor to execute the command
  • #473 Fix RGB colors in CustomArgument.CustomArgumentException#fromString creating the wrong colors
9.2.0 September 2023
  • #487 Added support for disabling integer centering for location arguments
  • #488 Fixed calling CommandAPI commands with Bukkit.createCommandSender() not working on paper
  • #482 Adds Kotlin DSL support for delegated properties
  • Fixed a bug where the CommandAPI would throw errors when unregistering commands when a command exists with a : at the end of its name
9.1.0 August 2023
  • Fixed the CommandAPI disabling datapacks on Paper 1.20.1 #40+ because it thought it was running on a Folia server
  • #459 Added the ability to access raw arguments in the command executor
  • #469 Adds AdventureChatColorArgument
  • #417 Added the ability for commands to be registered and unregistered while the server is running
9.0.3 June 2023
  • #455 Reworked the MapArgument with various features, including:
    • Optional quotes around keys and values
    • No restriction on the characters that are allowed in a key (previously only letters, digits, and underscore)
    • May define a String separator between key-value pairs (instead of just space)
  • Fixed use-latest-nms-version not pointing to 1.20
  • Adds support for Minecraft 1.20.1
9.0.2 June 2023 CommandAPI changes:
  • Add the ability to retrieve LiteralArguments and MultiLiteralArguments by their node names
  • #363 Adds withUsage() method to customise command usage info
  • #371 Updates default short description to now mention the plugin creating the command
  • Fixed literal arguments in command conversion causing errors due to parsing problems
  • Adds support for Minecraft 1.20
Other changes:
  • Update the look-and-feel of the CommandAPI website
  • Update the look-and-feel of the CommandAPI JavaDocs
  • Fix various classes in the CommandAPI JavaDocs not having their methods declared
9.0.1 May 2023
  • Fixed MapArgument not always allowing player names as keys
  • Fixed /execute as ... not working due to casting to a player instead of a proxied sender
  • #441 Added CommandArguments#count() utility method
  • #440 Added several CommandArguments#getOptional() methods
  • Fixed bug where IntegerArgument would fail to compile due to a missing Brigadier dependency
  • Added basic support for Folia
  • Added support for the CustomArgumentException to accept Adventure and Spigot text components
9.0.0 April 2023 ⚠️ This version is incompatible with any plugin that used the CommandAPI version 8.X.X or below! (See documentation for more information)
New features:
  • #360, #369 Made executor methods now use CommandArguments to allow for accessing arguments by name instead of index
  • #162, #387, #393 Added optional arguments
  • #388 Added new hook-paper-reload config option to toggle whether the CommandAPI hooks into /minecraft:reload
  • #399, #418 Added a MapArgument
  • Reworked the implementation of ItemArgument, so the ItemStack count is correctly reflected and ItemMeta is properly assigned
  • Made the TeamArgument return a Team instead of a String
  • Made the ObjectiveArgument return a Objective instead of a String
  • #391 Made the CommandAPI only complain about commands registered in a plugin.yml if this plugin.yml belongs to the plugin calling the CommandAPI
  • #422 Added a way to access the raw command a player typed from the executor
  • #431 Added a way to access more info to construct lists for the ListArgumentBuilder
  • Added support for sidebar team colors using an enum for ScoreboardSlot
Kotlin DSL changes:
  • Implemented resulting executors
  • Implemented the FunctionArgument
  • Several improvements for the CommandAPICommand DSL
Bug fixes:
  • Fixed commandapi-preprocessor appearing in the plugin and shaded jar file
  • #390 Fixed .executesNative()'s CommandSender's getLocation() method returning the wrong pitch and yaw
  • Fixed tags showing up in the BiomeArgument when they shouldn't have been doing so
  • Fixed LocationArgument with BLOCK_POSITION not returning locations in unloaded chunks
Testing and validation:
  • Created the testing matrix to perform multi-Minecraft-version testing
  • Bugs found (and fixed) as a result of the testing matrix:
    • Fixed IntegerRangeArgument and FloatRangeArgument not working on Minecraft 1.16.4 and 1.16.5
    • Fixed RecipeArgument not working on Minecraft 1.17
    • Fixed TeamArgument not working on Minecraft 1.17
    • Fixed AdventureChatArgument not working on Minecraft 1.17
    • Fixed commands with no executors not being caught by the CommandAPI
    • Fixed ParticleArgument producing "Invalid particle data type" warnings on Minecraft 1.16.5 and below
    • Fixed FunctionArgument not working on Minecraft 1.17.x and 1.18.x
    • Fixed NamespacedKeyArgument not working on Minecraft 1.18
  • Integrated the CommandAPI repository with SonarCloud to identify bugs and improve the internal code
  • Bugs found (and fixed) as a result of using SonarCloud:
    • Fixed the FunctionArgument not correctly retrieving datapack (function) tags in 1.17+
  • Added some code coverage reports to identify how well tested the CommandAPI is, and what code paths need attention to during development
  • Issues found (and fixed) as a result of using code coverage reports:
    • Removed some redundant vibration particle handling code that would never be run under any circumstances
Documentation changes:
  • #384 Fixed various particle data not being documented for the ParticleArgument documentation page
  • Fixed broken links in the documentation (using Michael-F-Bryan/mdbook-linkcheck)
  • Refactored documentation argument page names for consistency
  • Added Kotlin DSL examples
Other changes:
  • Removed all previously deprecated constructors, classes and methods
  • Completely refactored the entire CommandAPI project to help support other platforms
  • Added a live dev build of the documentation at commandapi-live-docs.jorel.dev
  • Improved mobile support for the CommandAPI home page
  • Added the CommandAPI's Modrinth link to the CommandAPI home page
  • Dropped support for Minecraft 1.13 - 1.14.4. Please use an older version of the CommandAPI, or raise an issue on GitHub to bring back support for these versions
GitHub Actions changes:
  • Fixed NodeJS 12 deprecation warnings
  • Added markdownlint to verify that the documentation adheres to suitable Markdown standards
  • Fixed building the CommandAPI example projects not failing if they failed to compile
  • Added the CommandAPI documentation to GitHub Actions
  • Added deployment of snapshot builds to GitHub Actions
8.8.0 March 2023
  • Adds support for Minecraft 1.19.4
8.7.6 February 2023
  • #415 Fixed NullPointerException when the CommandAPI fixes permissions in its post-load step
8.7.5 February 2023
  • Fixed @AWorldArgument annotation not being handled by the annotation processor
8.7.4 January 2023
  • Fixed LootTableArgument (function, recipe, sound, advancement, biome and entities) in 1.17 - 1.19.3
8.7.3 January 2023
  • #397 Fixed WorldArgument not working in 1.16.5
8.7.2 January 2023
  • Hotfixed issue where various arguments wouldn't work in 1.19.3 (function, recipe, sound, advancement, biome, entities, loot table)
  • Fixed issue where the WorldArgument wouldn't work in 1.19.3
8.7.1 December 2022
  • #310 Hotfixed a null pointer exception with redirected commands
  • #383 Fixed ParticleArgument not working in 1.19.3
  • Fixed EnchantmentArgument not working in 1.19.3
  • Fixed JavaDocs in IDEs not working when using commandapi-shade
  • Hotfixed permission check failing when permissions have been incorrectly initialized
8.7.0 December 2022
  • Note: This version is incompatible with any plugin that used the SoundArgument in version 8.6.0! (See documentation for more information)
  • Adds support for Minecraft 1.19.3
  • Deprecates Argument "type" constructors in favour of static inner classes
8.6.0 December 2022
  • #307 Adds a CommandArgument to let users submit commands as an argument
  • #330 Improve the documentation for disabling the CommandAPI gracefully with CommandAPI.onDisable()
  • #334 Adds support for chat components in CommandAPI.fail()
  • #338 Adds a way to clone a CommandAPICommand instance using instance.copy()
  • #340 Adds Kotlin examples in the documentation
  • #341 Fix incorrect code block in normal executors documentation page
  • #351 Adds support for a ListArgument with the TextArgument backend, to allow inline lists
  • #358 Adds a new WorldArgument argument that lets you get a list of Minecraft dimensions
  • Adds support for SoundArgument to return string-based sounds via the NamespacedKey
  • #352 Adds some helper methods to the LiteralArgument to make it easier to use via a static import
  • #357 Adds a Kotlin DSL to register commands in Kotlin!
8.5.1 August 2022
  • #311 Fix packets with invalid signatures kicking the client when sending certain commands with a chat preview enabled argument
  • #312 Safeguards against command paths with duplicate node names which could cause the client to crash
  • #313 Fix subcommand information being overwritten after a command has been registered
  • #314 Fix TimeArgument not working as intended
  • #316 Fix server reloading on Spigot throwing asynchronous-related exceptions in the console
  • #323 Fix NamespacedKeyArgument not working in 1.17
  • Fix various command issues with Minecraft versions before 1.19
  • Fix argument suggestions not working if a subcommand's node name is the same as the argument's node name
  • Improves the underlying implementation of chatcolor, enchantment and potion arguments in 1.17+
  • Improves NMS code sharing between 1.19, 1.19.1 and 1.19.2
  • Improves the implementation of the list argument to only display suggestions for the last item in the list and prevent unlisted items being entered
  • Adds support for Minecraft 1.19.2
8.5.0 July 2022 Development improvements:
  • Improves the issue templates on GitHub for creating bug reports and feature requests
  • Adds a testing suite for the CommandAPI which can test for successful command registration and execution
  • Adds an example of shading the CommandAPI with Maven in examples/maven-shaded/
Bug fixes:
  • Fixes suggestions not working in 1.16.5 and below due to Brigadier implementation versions
  • Fixes the CommandAPI allowing spaces in command names
  • Fixes datapack reloading on 1.17.1
New features/improvements:
  • Adds support for Minecraft 1.19.1
  • Adds support for chat preview with ChatArgument and AdventureChatArgument
  • Adds a CommandAPI.onDisable() method to disable the CommandAPI gracefully
  • Adds Kotlin-DSL gradle to the documentation
  • Prevents the CommandAPI re-parsing previous arguments multiple times when running a command
  • Adds CommandAPI.isLoaded() to check if the CommandAPI is loaded
  • Shares NMS code for 1.13.x and 1.14.x, reducing the jar size
8.4.1 June 2022
  • Fix issue where converted commands would handle arguments incorrectly
  • Fix commandapi-annotations dependency depending on spigot instead of spigot-api
8.4.0 June 2022 Jar minimization improvements:
  • Decouples CustomArgument from CommandAPIHandler
  • Decouples EntitySelector from EntitySelectorArgument
NBT API Support:
  • Allow developers to shade their own copy of an NBT API framework (e.g. NBT API or PowerNBT)
  • Includes the NBT API built-in for plugin versions
Other:
  • Implement base arguments for CustomArguments, allowing more powerful parsing
  • Implement common NMS code for 1.17+
  • Adds NamespacedKeyArgument
  • Adds support for shaded versions of the CommandAPI to create their own command_registration.json files for debugging
  • Fixes bug where WrapperCommandSyntaxException wouldn't work as intended
  • Adds support for /minecraft:reload on paper servers
  • Adds CommandAPI.getRegisteredCommands() to get a list of registered commands
8.3.1 June 2022
  • Fixes critical issue where non-Vanilla commands were not showing suggestions
8.3.0 June 2022
  • Change Java target version to Java 16 instead of Java 17
  • Adds support for old Minecraft versions (1.13 - 1.16.4) again
  • Adds support for Minecraft 1.19
8.2.1 June 2022
  • Adds a .withSubcommands() method to add multiple subcommands in one go
  • Exposed registeredCommands field in the CommandAPIHandler to get a list of registered commands
  • Fixed CommandAPI logging prefix twice in shaded versions of the CommandAPI
8.2.0 May 2022
  • Adds a list argument
  • Brings back support for Minecraft 1.16.5
  • Fixes documentation bug with multiple executor types
  • Fixes bug where suggestions wouldn't "filter" while being typed in chat
8.1.0 May 2022
  • Adds generic types to arguments to improve compile-time type checking
  • Fix particle data safe suggestions crashing the CommandAPI
  • Improves error logging of greedy string arguments
  • Fix bug with CommandPermission.OP throwing a null pointer exception
  • Prevent the CommandAPI crashing when shaded plugins don't call CommandAPI.onLoad()
  • Fix initialization of WrapperCommandSyntaxException bug
8.0.0 April 2022
  • Note: This version is incompatible with existing plugins that use the particle argument (See documentation for more information)
  • Improved support for particle arguments, now supporting particle data (e.g. color, size)
  • Dropped support for Minecraft 1.16.5
  • Adds an error message if the config.yml's plugins-to-convert option has an invalid type
  • Improve WrapperCommandSyntaxException to include passthrough methods to access the underlying exception
7.0.0 April 2022 Development improvements:
  • Adds a GitHub action to build the CommandAPI (and share it's lovely artifacts)
  • Moves the Maven repo for 7.0.0 and future updates to Maven Central
New features:
  • Adds support for using the same command executor for multiple command sender types
  • Makes the CommandAPI display a warning if it finds commands present in a plugin.yml file
  • Adds more helper methods to the Brigadier class
  • Adds a tree-like syntax for command declarations
  • Adds support for asynchronous suggestions
  • Rewrote how argument suggestions are declared, instead of lots of overloads, require a single object which encompasses the various different suggestion methods
Other:
  • Fix transitive dependencies in the CommandAPI which caused various libraries to be exposed
  • Remove various deprecated safeOverrideSuggestions methods
  • Improve certain colors of elements in the CommandAPI's documentation so it's easier to read
  • Fix various broken links in the documentation
  • Changed CommandAPI.fail() so it doesn't automatically throw the exception it generates
6.5.4 March 2022
  • Support for Minecraft 1.18.2
  • Improve converted command support for /execute at and /execute positioned
6.5.3 December 2021
  • Support for Minecraft 1.18.1
6.5.2 December 2021
  • Fix Maven build script with 6.5.1, fixing broken CommandAPI annotation builds
6.5.1 December 2021
  • Fix Maven build script with 6.5.0, fixing broken CommandAPI shaded builds
6.5.0 December 2021
  • Adds support for Minecraft 1.18 (requires Java 17)
6.4.0 November 2021
  • Adds support for CommandAPI command help topics via /help
  • Improve CommandAPI initialization stability
  • (Hopefully) fix conflicting issues with duplicate Bukkit and CommandAPI command names
  • Code cleanup (fix a lot of minor warnings)
6.3.1 September 2021
  • Fixes issue with converted commands where executing as a player with lower permissions fails
  • Adds very limited support for plugin reloading by unregistering commands on disable
  • Fixes issue where converted commands with greedy string arguments would almost always fail
6.3.0 August 2021
  • Adds a new constructor to CustomArgument which takes in a record containing all inputs
  • Adds support for CustomArgument's parser to use previously declared arguments
6.2.0 July 2021
  • Adds config option to customize messages
  • Adds config option to use the latest NMS version
  • Update documentation instructions for shading with Maven
6.1.0 July 2021
  • Adds support for 1.17.1
6.0.5 June 2021
  • Fix issue where converted commands which didn't use entity selectors would always fail
6.0.4 June 2021
  • Fix issue where some multi literal arguments would be skipped, causing a crash
6.0.3 June 2021
  • Fix issue where custom CommandSender subclasses could not run CommandAPI commands
6.0.2 June 2021
  • Fix bug where multi literal arguments would crash due to poor array preservation
6.0.1 June 2021
  • Fix bug where the CommandAPI would crash if it tries to register duplicate permissions
6.0.0 June 2021 Version support changes:
  • Adds support for Minecraft 1.17
  • Drops support for Minecraft 1.16.4 and below
  • Changes build version from Java 8 to Java 16
Development improvements:
  • Switches version convention to use Semanic Versioning
  • Uses CodeFactor.io for code quality checking
New features:
  • Adds OfflinePlayerArgument for offline players
  • Adds a way to add suggestions to existing vanilla suggestions
  • Adds a way to access the CommandSender for CustomArgument parsing
  • Adds support for Paper's console tab-completion
  • Adds a way to completely silence all CommandAPI logs
  • Adds access to the current input and current argument input for argument suggestions
  • Improve API for setting configuration for plugins that shade the CommandAPI
Bug fixes:
  • Fixes bug with converted commands crashing due to poor interface proxying
  • Adds a way to access the CommandSender for CustomArgument parsing
  • Adds support for Paper's console tab-completion
  • Adds a way to completely silence all CommandAPI logs
  • Fix bugs where the NBTAPI wouldn't be hooked into properly
  • Fixes critical issue where converted commands with entity selectors may sometimes just not run
Other:
  • Improves overall performance
  • Improves performance for the PotionArgument
  • Improves performance for the MathOperationArgument
  • Fixes spacing issues with code blocks in the documentation
  • Fixes invalid code examples in the documentation
  • Fixes typos in the documentation
  • Adds syntax highlighting for command code blocks in the documentation
5.12 May 2021
  • Moves the Maven repo for 5.12 and future updates to jitpack.io
  • Fixes issue with sound arguments on Minecraft 1.16.4 and 1.16.5
5.11 May 2021
  • Allows converted commands to use entity selectors in plugin commands
  • Allows arbitrary commands to be converted with the CommandAPI's converter system
5.10 May 2021
  • Adds support for Paper's Adventure API for ChatComponent and Chat arguments.
  • Deprecated a few methods in favour of some slightly better ones.
  • Update proxied sender for Spigot 1.16.5
5.9 February 2021
  • Fixed a critical bug where plugin conversion would run the caller methods instead of callee methods, which prevented command blocks from running commands.
5.8 January 2021
  • Removed a debug /test command which wasn't supposed to be released!
5.7 January 2021
  • Add support for Minecraft 1.16.5
5.6 January 2021
  • Fix bug where plugins that use Aikar's ACF were incompatible with the CommandAPI
  • Add a new configuration option skip-sender-proxy which prevents certain plugins from running properly
5.5 January 2021
  • Fix bug with annotations where @NeedsOp didn't work if placed on a class
  • Fix bug where entity selector arguments with @ selectors return empty values if the sender is not op
5.4 December 2020
  • Fix bug where the NBT-API wasn't compatible with the CommandAPI when both are shaded into a plugin
5.3 November 2020
  • Fix bug where permissions weren't being applied for subcommands and multi literal arguments
  • Adds detection system for command graph conflicts
  • Adds a way to "negate" permissions using .withoutPermission
  • Adds an annotation-based command framework
  • Fix minor documentation inaccuracies
  • Fix bug where converted commands didn't apply multiple parameters
  • The fields in CommandAPICommand can now be accessed via getters and setters
5.2 November 2020
  • Adds CommandAPI.reloadDatapacks() method to reload datapacks in the same way the CommandAPI does
  • Adds support for Minecraft 1.16.4
5.1 October 2020
  • Fixes bug where converted commands could not be executed by players ingame
  • Adds withPermission(String) to arguments and CommandAPICommands
  • Adds SimpleFunctionWrapper with helper methods to get functions and tags from ingame, as well as run them without needing to parse them via commands
  • Greatly improve the type-safety of the internal CommandAPI code
  • Move the Brigadier class outside of the CommandAPIHandler class
5.0 October 2020
  • Note: This version is incompatible with any plugin that used the CommandAPI version 4.3c or below! (See documentation for more information)
  • API improvements:
    • The .withArguments method can now take varargs
    • String tooltips are now much easier to implement for custom objects using IStringTooltip
    • Removes LinkedHashMap for argument registration in favour of List
  • Adds subcommands
  • Adds AngleArgument
  • Arguments can now be omitted from the Object[] args using the method .setListed(). This means Literal arguments can now be "present" in the arguments if desired.
  • Remove lots of reflection calls, so start up should be a little faster
  • Bug fixes:
    • Fixes bug where verbose logging of permission linking was inaccurate
    • Fixes bug where overriding suggestions can break when generating suggestions
    • Fixes bug where null could appear in the suggestions list of arguments
    • CommandAPI's non-verbose logging is now actually quiet
    • Fixes bug where converted commands couldn't be run from the console
    • Fixes bug where LongArgument wouldn't let you use long values as minimum or maximum
  • Command conversion improvements:
    • The Converter.convert() method can now take varargs for arguments
    • Command conversion code that was specific to the CommandAPI plugin is no longer included in the shaded version of the CommandAPI
    • Command conversion in the configuration for server owners can now let server owners apply their own command argument implementations!
  • Documentation improvements:
    • Documentation code examples are now guaranteed to compile
    • The list of CommandAPI arguments to Minecraft argument IDs is now in the documentation
  • CommandAPI-Brigadier improvements:
    • Adds toSuggestions() to the CommandAPI-Brigadier library to convert CommandAPI suggestions into Brigadier's SuggestionProvider
    • CommandAPI-Brigadier library methods got renamed
    • Changed the way literal arguments are constructed in the CommandAPI-Brigadier library - they are no longer unnecessarily registered into the command graph
4.3c October 2020
  • Fixes bug where function loading would break because permissions could not be properly computed
4.3b September 2020
  • Fixes minor command sender related bugs from 4.3a. Fixes permissions with /execute ... as ... from converted commands
4.3a September 2020
  • Fixes a bug where running converted commands via /execute ... as ... wouldn't apply the command sender correctly
4.3 September 2020
  • Fix bug where resulting command executors with command block senders would not work
  • Improves the power of command conversion by letting you declare CommandAPICommand arguments for conversion
  • Adds support for YAML's "null" for command conversion via the config.yml file, which should be way more comprehensible rather than trailing colons
4.2 September 2020
  • Adds support for Minecraft 1.16.3
  • Fixes a bug where shading the CommandAPI and the NBT-API together causes the CommandAPI to incorrectly think that the NBT-API isn't present
  • Fixes a bug where commands with redirects (4.0+ aliases and redirects from /execute) that have two consecutive arguments with suggestions would spam the console and not provide suggestions
  • Adds NativeProxyCommandSender which lets you access the location and world of a command sender via /execute in|positioned|at|facing|rotated
4.1 September 2020
  • Allows the CommandAPI to be shaded into plugins
  • Adds a way to set hover tooltips for suggestions
  • Adds multi-literal arguments
  • Adds a logo!
  • Adds a new method to the CommandAPI/Brigadier system to easily create Brigadier arguments from CommandAPI arguments
  • Rename maven modules You can view more information about this on the public maven repository
4.0 August 2020
  • Suggestion overriding can now be populated by Bukkit objects instead of strings
  • Fixes a bug with the FloatRangeArgument where it caused a casting error
  • Adds support for 1.16.2
    • ChatArgument now works on Minecraft 1.16.2 (still doesn't work on 1.16.1)
  • Adds new arguments:
    • UUIDArgument
    • ItemStackPredicateArgument
    • BlockPredicateArgument
  • Fix bug where CustomArguments break when using the namespaced key flag
  • Adds a list of commands that FunctionWrapper executes which is now accessible
  • Command aliases are now much more efficient
  • Documentation changes (briefly):
    • BlockStateArgument is now documented properly
    • Documentation now has pictures to show you what arguments look like
    • Documentation now has a page dedicated to what doesn't work on what Minecraft version
  • Adds Brigadier support for developers (lets you use the CommandAPI and Brigadier code side by side!)
  • Fixes a bug where Java 12+ had incompatibility issues
  • Adds support for setting arbitrary requirements to arguments and commands
3.4 July 2020
  • Fix bug with custom recipes not registering in Minecraft 1.16+
  • Fix bug where command conversion didn't actually register commands
  • Adds command conversion as a built-in feature via the CommandAPI's config.yml
3.3 July 2020
  • Fixes a bug where functions didn't work in Minecraft 1.16+
  • Fixes a bug where spigot produces a warning about api-versions
3.2 July 2020
  • Fixes a bug with .overrideSuggestions() from version 3.1
3.1 July 2020
  • Fixes bug where command senders didn't work properly, causing commands to not work properly
  • Adds the ability to override suggestions with the information of previously declared argument
3.0 June 2020
  • Note: This version is incompatible with pre 3.0 versions CommandAPI plugins (See documentation for more information)
  • Complete code refactor to make command syntax slightly more intuitive and consistent
  • Removes lots of reflection to improve performance
  • Adds better documentation
  • Adds JavaDocs
  • Adds support for 1.16.1
  • Adds new command executors (These let you filter commands based on what type of command executor runs the command):
    • Player command executors
    • Command block command executors
    • Console command executors
    • Entity command executors
    • Proxied command executors
  • Adds new arguments:
    • Axis Argument
    • Biome Argument
    • ChatColor Argument
    • Chat Argument
    • FloatRange Argument
    • IntegerRange Argument
    • Location2D Argument
    • MathOperation Argument
    • NBT Argument (NBTAPI required)
    • Scoreboard arguments:
      • Objective Argument
      • ObjectiveCriteria Argument
      • ScoreboardSlot Argument
      • ScoreHolder Argument
      • Team Argument
    • Time Argument
    • Rotation Argument
    • Environment Argument
    • Removes old arguments:
      • SuggestedStringArgument
      • DynamicSuggestedStringArgument
      • DefinedCustomArguments
2.3a December 2019
  • Adds support for Minecraft 1.15, 1.15.1 and 1.15.2
2.3 August 2019
  • Fixes bug where permissions didn't work
  • Fixes bug where functions weren't working on 1.14.3 and 1.14.4
2.2 July 2019
  • Adds support for Minecraft 1.13 and 1.13.1 (Funny isn't it? It's called the 1.13 CommandAPI but never supported Minecraft 1.13 until now)
  • Improves support for different versions
  • Adds pointless witty comments into changelog notes
  • Adds 1.13-Command-API-SafeReflection library to greatly improve reliability of reflection calls
2.1 July 2019
  • Adds RecipeArgument
  • Adds SoundArgument
  • Adds AdvancementArgument
  • Adds LootTableArgument
  • Adds support for 1.14.3 and 1.14.4
  • Fixes bug where aliases weren't registering properly (#43)
  • Fix documentation for tooltips
  • Improve documentation for dependencies and repositories
2.0.1 May 2019
  • Fix a bug where Brigadier was required as a dependency to build plugins
2.0 May 2019
  • Compatibility for 1.14
  • Major overhaul of the CommandAPI's internals - greatly improves performance
  • Deprecates SuggestedStringArgument, adding overrideSuggestions as an alternative for any argument type
  • Adds CustomArguments, allowing you to create your own ... custom arguments
  • Excludes dependencies from final jar (#40)
  • Adds DefinedCustomArguments - CustomArguments that have been created by yours truly
  • DynamicSuggestedArguments now have access to the CommandSender (#41)
  • Adds Loot Table support
1.8.2 January 2019
  • Fix bug with PlayerArgument when player cannot be found
  • Adds LocationArgument options for block precision or exact precision
1.8.1 December 2018
  • Fix permissions for argument from 1.8
  • Neaten up logging with verbose outputs
1.8 December 2018
  • Fix bugs where DynamicSuggestedArguments don't work as the last argument
  • Fix support for latest spigot version
  • Adds permissions for arguments
  • Adds support to override suggestions for arguments
1.7.2 December 2018
  • Fix a bug where default return value was 0 instead of 1, causing issues with commandblocks
1.7.1 December 2018
  • Fix a bug with permission checks. Other than that, it's the same as 1.7 (in terms of documentation)
1.7 December 2018
  • Adds DynamicSuggestedStringArguments for dynamically updating suggestions
  • Adds support for success and result values for /execute store
  • Overhaul permissions system so it works properly
  • Note: This version is incompatible with pre-1.7 version CommandAPI plugins
1.6 November 2018
  • Adds FunctionArguments to handle Minecraft functions
  • Remove useless test code
  • Fix bug with ProxiedCommandSender callee and caller
  • Adds Converter for legacy plugin support
  • Improved performance by caching NMS better than in version 1.5
1.5 October 2018
  • Adds ChatComponentArgument to handle raw JSON
  • Adds SuggestedStringArgument to suggest strings
  • Adds config file
  • Fix bug where command errors weren't being thrown
  • Improved performance by caching NMS
1.4 October 2018
  • Fix critical bug where arguments weren't being handled properly
  • Adds GreedyStringArgument
  • Adds various Exception classes
1.3 October 2018
  • Migrate to Maven
  • Remove unnecessary reflection
  • Adds EntitySelectorArgument
  • Adds LiteralArgument
  • Adds support for ProxiedCommandSender
1.2 August 2018
  • Adds TextArgument
1.1 August 2018
  • Adds PlayerArgument
  • Adds ParticleArgument
  • Adds ChatColorArgument
  • Adds EnchantmentArgument
  • Adds LocationArgument
  • Adds EntityTypeArgument
  • Adds permissions support
  • Adds alias support
1.0 August 2018
  • Initial release

About

A Bukkit/Spigot API for the command UI introduced in Minecraft 1.13

https://commandapi.jorel.dev

License:MIT License


Languages

Language:Java 74.2%Language:JavaScript 17.1%Language:Kotlin 5.6%Language:TypeScript 1.8%Language:CSS 0.7%Language:Handlebars 0.4%Language:Shell 0.1%Language:HTML 0.0%