CommandClip
CommandClip is a specialized command framework designed specifically for Bukkit server plugins. This library significantly simplifies the process of creating, configuring, and managing commands in plugins, saving developers' time and reducing potential errors.
Setting Up Dependencies
For Gradle Projects
Add the following configurations to your build.gradle file:
repositories {
mavenCentral()
}
ependencies {
compileOnly("io.github.nottamion:commandclip:1.1.0")
}
For Maven Projects
Specify the dependency in pom.xml:
<dependency>
<groupId>io.github.nottamion</groupId>
<artifactId>commandclip</artifactId>
<version>1.1.0</version>
</dependency>
The recommended approach is to let the server automatically download the library. This requires just one line in the plugin.yml file:
libraries:
- io.github.nottamion:commandclip:1.1.0
This method provides several benefits: it reduces the plugin file size and eliminates the need to embed the framework directly into the JAR file.
How to Use
Comprehensive documentation for working with the framework is available in the project repository. To understand the core capabilities, review the following implementation example:
new BaseCommand("hello", this)
.subCommand(new SubCommand("there")
.executes((commandSender, s, strings) -> {
commandSender.sendMessage(s + " there " + strings[0]);
})
.tabCompletes((commandSender, s, strings) ->
strings.length == 1 ?
Bukkit.getOnlinePlayers().stream().map(Player::getName).toList() :
List.of()
)
.testArgs((commandSender, s, strings) -> {
if (strings.length != 1)
return "Please provide a valid player name";
if (!Bukkit.getOnlinePlayers().stream().map(Player::getName).toList().contains(strings[0]))
return "Player is currently not online";
return null;
})
.permission("hello.there", "You don't have permission to use this command :("))
.alias("hi")
.commandDescription("Greeting command")
.commandPermission("hello")
.register();
This implementation demonstrates a fully-featured command structure with support for tab completion, permission checking, and argument validation.