Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maksim2498/mc-commands
Java library that provides better command API for Bukkit plugins
https://github.com/maksim2498/mc-commands
bukkit commands java library papermc spigot
Last synced: 10 days ago
JSON representation
Java library that provides better command API for Bukkit plugins
- Host: GitHub
- URL: https://github.com/maksim2498/mc-commands
- Owner: Maksim2498
- License: mit
- Created: 2022-08-10T21:12:57.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-04T14:47:03.000Z (over 2 years ago)
- Last Synced: 2024-11-20T13:17:07.602Z (2 months ago)
- Topics: bukkit, commands, java, library, papermc, spigot
- Language: Java
- Homepage:
- Size: 203 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Commands
![Logo](/images/logo.png)
## Index
- [Index](#index);
- [About](#about);
- [Installation](#installation);
- [Building](#building);
- [Examples](#examples);
- [Teleportation Plugin](#teleportation-plugin);
- [Real Plugin](#real-plugin);
- [Documentation](#documentation).## About
This is a java library which provides a better commands API for Bukkit plugins.
## Installation
First, add MoonTalk repository to your pom.xml:
```xml
moontalk
httsp://repo.moontalk.space/repository/maven-releases/```
Second, add library as dependency:
```xml
space.moontalk.mc
commands
4.1.2```
Done.
## Building
Just execute the following Maven command in your terminal:
```bash
mvn install
```## Examples
### Teleportation Plugin
This is a simple player-to-player teleportation plugin example:
```java
public class Plugin extends JavaPlugin {
@Override
public void onEnable() {
final var commandHandler = new DefaultMultiCommandHandler(this);commandHandler.addCommandRoute("mytp %p %p", call -> {
final Player from = call.getPlaceholdedAt(0);
final Player to = call.getPlaceholdedAt(1);
from.teleport(to);
});
}
}
````%p` is a _placeholder_ which stands for an online player.
With this little of code you get:
- autocompletions;
- error handling;
- working `mytp` command.For real projects you can config all messages and add your own placeholders.
Also you can specify required _priority_ and command _sender classes_ for _route handlers_.### Real Plugin:
For a complete real-world example you can see [this plugin](https://github.com/Maksim2498/mc-cpspeed).
Full power of the plugin is shown in the `setupCommands` method of the [main class](https://github.com/Maksim2498/mc-cpspeed/blob/main/src/main/java/space/moontalk/mc/cpspeed/CPSpeed.java);## Documentation
Will be added soon... (maybe)