A minimal event-driven command core for Minecraft servers.
π Π ΡΡΡΠΊΠΈΠΉ
The standard Bukkit/Paper API does not provide a convenient way for other plugins to know:
- Was the command executed successfully?
- Did an error occur?
- Did the player lack permission?
- Was the command cancelled?
Wairovel Command API solves this by providing a unified event-driven API for registering commands with automatic execution result event publishing.
Wairovel Command API is installed as a standalone plugin on the server (similar to Vault, PlaceholderAPI, or ProtocolLib). Other plugins connect to it through a shared API.
server/plugins/
βββ Wairovel-Command-API-0.1.0.jar β install once on the server
βββ YourSpawnPlugin.jar β uses the API
βββ YourRewardsPlugin.jar β listens to command events
This is necessary because the library's main purpose is inter-plugin communication β all plugins must share a single EventBus to see each other's command results.
Download Wairovel-Command-API-0.1.0.jar and place it in your server's plugins/ folder.
repositories {
maven("https://jitpack.io")
}
dependencies {
compileOnly("com.github.Wairovel.Wairovel-Command-API:api:0.1.0")
}<dependency>
<groupId>com.github.Wairovel.Wairovel-Command-API</groupId>
<artifactId>api</artifactId>
<version>0.1.0</version>
<scope>provided</scope>
</dependency>depend: [Wairovel-Command-API]public class SpawnPlugin extends JavaPlugin {
@Override
public void onEnable() {
CommandManager manager = WairovelCommandApi.instance().commands();
WairovelCommand spawn = manager.register("spawn");
spawn.permission("server.spawn")
.description("Teleport to spawn")
.executor(context -> {
Player player = context.sender(Player.class);
player.teleport(player.getWorld().getSpawnLocation());
player.sendMessage("Teleported to spawn!");
context.success();
});
}
}public class RewardsPlugin extends JavaPlugin {
@Override
public void onEnable() {
CommandManager manager = WairovelCommandApi.instance().commands();
manager.subscribe(CommandExecutedEvent.class, event -> {
if (event.command().equals("spawn") && event.isSuccess()) {
Player player = event.sender(Player.class);
giveReward(player);
player.sendMessage("You received a reward for teleporting!");
}
});
}
}public class AuditPlugin extends JavaPlugin {
@Override
public void onEnable() {
CommandManager manager = WairovelCommandApi.instance().commands();
manager.subscribe(CommandExecutedEvent.class, event -> {
getLogger().info(String.format(
"[%s] /%s %s -> %s (%dms)",
event.sender(Player.class).getName(),
event.command(),
String.join(" ", event.args()),
event.result().name(),
event.duration()
));
});
}
}| Value | Description |
|---|---|
SUCCESS |
Command executed successfully |
NO_PERMISSION |
Sender lacks required permission |
INVALID_ARGUMENT |
Invalid argument provided |
NOT_FOUND |
Resource not found (home, warp, etc.) |
CANCELLED |
Command was cancelled |
ERROR |
Unexpected error occurred |
context.sender(); // Object β raw sender
context.sender(Player.class); // Typed cast
context.command(); // Command name
context.args(); // String[] arguments
context.arg(0); // Specific argument (null-safe)
context.success(); // Mark as success
context.fail(); // Mark as failed
context.noPermission(); // No permission
context.invalidArgument(); // Invalid argument
context.notFound(); // Resource not found
context.cancel(); // Cancelled
context.error(exception); // Error with throwableWairovelCommand cmd = manager.register("home");
cmd.permission("homes.use");
cmd.description("Teleport home");
cmd.executor(ctx -> { ... });
cmd.enabled(false); // Temporarily disable
cmd.enabled(true); // Re-enable
cmd.unregister(); // Full unregistrationevent.command(); // Command name
event.sender(); // Sender
event.sender(Player.class); // Typed sender
event.args(); // Arguments
event.result(); // CommandResult
event.isSuccess(); // Quick success check
event.duration(); // Execution time (ms)
event.timestamp(); // Event time (epoch ms)
event.error(); // Throwable if ERRORwairovel-command-api/
βββ api/ # Public API β zero platform dependencies
βββ core/ # Internal implementation
βββ paper/ # Paper-specific integration
apiβ dependency for all consumer pluginscoreβ internal logic (not for external use)paperβ bridge to Paper with automatic version detection:- 1.16.5β1.20.4 β Bukkit CommandMap (legacy)
- 1.20.6+ β Paper LifecycleEvents + Brigadier (modern)
| Platform | Versions | Java |
|---|---|---|
| Paper | 1.16.5 β 1.21.x | Java 16+ |
- Command arguments API
- Tab completion
- Permission handlers / middleware
- Brigadier deep integration
- Async execution support
- Command cooldowns
- Command analytics
- Velocity / Minestom platforms
- Java 16+
- Paper 1.16.5+
- Gradle
MIT