Commands
PluginLib offers a simple way to create your commands and handles a few errors in the process
Creating a Command
Add the command to your plugin.yml
name: FakePlugin
author: Darrionat
main: me.darrionat.FakePlugin
description: A fake plugin with commands
version: 1.0.0
api-version: 1.13
commands:
ban:
usage: /<command>Create a BaseCommand
package me.darrionat.fakeplugin.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import me.darrionat.pluginlib.Plugin;
import me.darrionat.pluginlib.commands.BaseCommand;
public class FakeCommand extends BaseCommand {
public FakeCommand(Plugin plugin) {
super(plugin);
}
@Override
public String getCommandLabel() {
return "ban";
}
@Override
protected void runNoArgs(CommandSender sender, Command command, String label, String[] args) {
/*
* Do stuff
*/
}
}SubCommands
Adding a SubCommand to your BaseCommand
Example of a SubCommand Class
Last updated