Skip to content

FlyUltra/TheCommandAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TheCommandAPI

badge badge badge badge badge badge badge

Are you bored with creating typical commands?
Try our API for your Spigot commands.

Table of contents

Getting started

Make sure you reloaded maven or gradle in your project.

Add TheCommandAPI to your project

badge

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'
}

Example

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;
    }
}

License

TheCommandAPI is licensed under the permissive MIT license. Please see LICENSE.txt for more information.

About

Simple Command API for Spigot

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages