Are you bored with creating typical commands?
Try our API for your Spigot commands.
Make sure you reloaded maven or gradle in your project.
You need to add this dependency into your plugin, then look at under the dependencies example
Maven
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.iVantional</groupId>
<artifactId>TheCommandAPI</artifactId>
<version>VERSION</version>
<scope>provided</scope>
</dependency>
</dependencies>
Gradle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.iVantional:TheCommandAPI:VERSION'
}
Command example
public class Example extends Command {
// One type of constructor for register
public Example() {
super("example", new String[]{"test"}, "Example command!");
}
// Second type of constructor for register
public Example(String command, String[] aliases, String description) {
super(command, aliases, description);
}
// Command example
@Override
public void execute(CommandSender sender, String[] args) {
sender.sendMessage("Example command!");
}
// Tab completer example
@Override
public List<String> onTabComplete(CommandSender sender, String[] args) {
List<String> arguments = new ArrayList<>();
Player player = (Player) sender;
if (!player.hasPermission("admin")) {
return Arrays.asList(" ");
}
if (args.length == 1) {
return StringUtil.copyPartialMatches(args[0], Arrays.asList("tab", "complete"), new ArrayList<>());
}
return arguments;
}
}
TheCommandAPI is licensed under the permissive MIT license. Please see LICENSE.txt
for more information.