-
Notifications
You must be signed in to change notification settings - Fork 1
Home
MmCommands provides a way for developers to spend less time implementing the overhead of their commands by offering an easy API that takes care of dispatching, auto-completion, permission handling and so much more!
To use this API, you will need to add it as a dependency to your project.
<repositories>
<repository>
<id>MmPlugins</id>
<url>https://github.com/Mmaarten23/Maven/raw/master</url>
</repository>
...
</repositories>
<dependencies>
<dependency>
<groupId>com.mmaarten</groupId>
<artifactId>MmCommands</artifactId>
<!--insert version here-->
<version>1.0.0</version>
</dependency>
</dependencies>repositories {
maven { url 'https://github.com/Mmaarten23/Maven/raw/master' }
}
dependencies {
compileOnly "com.mmaarten:MmCommands:1.0.0"
}This API is a handler for a registered plugincommand. If you do not yet have a command registered, please do so now by following this pattern inside of the plugin.yml:
commands:
# the name for your command. Used as /base
base:
description: Base commandMore info about which attributes you can specify can be found here.
Inside your main plugin class (the class in your plugin that extends JavaPlugin), you now want to register an instance of the MmCommandHandler as executor for the plugincommand. In most cases, this registering will happen inside of the onEnable() method. Your main class should look something like this:
package com.mmaarten.myplugin;
import com.mmaarten.mmcommands.MmCommandHandler;
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
Bukkit.getPluginCommand().setExecutor(new MmCommandHandler())
}
}This will attach a default MmCommandHandler to the plugincommand. This in itself will not add too much functionality but it is the first step to working with this API.