Command, useful method for interacting with players in Spigot plugin. I have realized that the Spigot Command's Api is not functional enough for larger projects. So the commands-api was created to replace it.
The commands-api is very easy to implement, deploy and use. It's compatible with all projects from small to large and any version of Spigot. Working with the root-child model, the root command equivalent to the spigot command and registered as PluginCommand. Reduce pass parameters for simplicity, custom command results, and more.
Notes: This is a library, not a spigot plugin.
Requirements
The source code used is java 8. Any java version lower than java 8 will cause errors.
- Java 8 or later
There are many ways to install libraries to your plugin dependencies. You can follow this instruction.
Maven
Add this section inside <dependencies> tag in your pom.xml.
HTML:
<dependency>
<groupId>xyz.tozymc.spigot </groupId>
<artifactId>commands-api </artifactId>
<version>2.2 </version>
</dependency>
<groupId>xyz.tozymc.spigot </groupId>
<artifactId>commands-api </artifactId>
<version>2.2 </version>
</dependency>
Gradle
Follow this instruction if your build tool is Gradle.
Code (Java):
dependencies
{
implementation 'xyz.tozymc.spigot:commands-api:2.2'
}
implementation 'xyz.tozymc.spigot:commands-api:2.2'
}
If your project doesn't have any build tools, you can install it manually.
- Download the library in github release.
- Import commands-api-2.2.jar file to your project.
- Implement command default abstract classes and design your command.
- Declare new CommandController instance and register implemented commands in the section 1 in the order to the controller declared.
- Let's start server and enjoy.
Since version 2.0, you don't need to add command to plugin.yml. Why? The major feature update in version 2.0 is dynamic command registration. What is it? Simply, you can register commands anywhere and at any time. Unregistration is similar. So adding command to plugin.yml isn't necessary.
License
Distributed under the MIT License. See LICENSE for more information.
External Links
- Javadoc: javadoc.io
- GitHub: github.com
- OSS Index: ossindex.sonatype.org
- Spigot Resources: spigotmc.org
Quick facts
- Edition: Minecraft Java
- File type: .jar
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
[API] commands-api is a free Minecraft Java mod. Downloaded 343 times (via Spigot). Download it and open it directly in the game.