CommandAPI
A simplistic, yet easy to use command API.
Install / Use
npx skills add NoSequel/CommandAPIInstalls into whichever agent you are using.
README
Command API
An opensource command API for the spigot API
Usage
Making a new command implementation:
import io.github.nosequel.Command;
import io.github.nosequel.Param;
import io.github.nosequel.Subcommand;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
public class ExampleCommand {
@Command(label = "example")
public void example(BukkitCommandExecutor player, @Param(name = "text", value = "hello") String text, @Param(name = "description") String description) {
player.sendMessage(ChatColor.RED + text);
player.sendMessage(ChatColor.YELLOW + description);
}
@Subcommand(parentLabel = "example", label = "sheep")
public void sheep(BukkitCommandExecutor player, String entityType) {
final Location location = player.getPlayer().getLocation();
final EntityType type = EntityType.valueOf(entityType);
location.getWorld().spawnEntity(location, type);
}
}
Making a new type adapter implementation:
import java.util.UUID;
public class UUIDTypeAdapter implements TypeAdapter<UUID> {
/**
* Convert a {@link String} to the {@link Double} object type
*
* @param executor the executor of the command
* @param source the source to convert
* @return the converted object
*/
@Override
public UUID convert(CommandExecutor executor, String source) throws Exception {
return UUID.fromString(source);
}
}
Registering the command you've just created:
import com.sun.corba.se.impl.activation.CommandHandler;
import io.github.nosequel.CommandHandler;
import org.bukkit.plugin.java.JavaPlugin;
public class ExamplePlugin extends JavaPlugin {
@Override
public void onEnable() {
final CommandHandler commandHandler = new BukkitCommandHandler("commands");
commandHandler.registerTypeAdapter(UUID.class, new UUIDTypeAdapter());
commandHandler.registerCommand(new ExampleCommand());
}
}
Related Skills
node-connect
385.5kDiagnose OpenClaw Android, iOS, or macOS node pairing, QR/setup code, route, auth, and connection failures.
blender-python-addon
40.5kBlender Python add-on rules for operators, panels, properties, registration, testing, and API-safe scripting
flutter-development-guidelines-cursorrules-prompt-file
40.5kCursor rules for Flutter development with MVVM architecture, Riverpod state management, Material widgets, and Dart style guidelines.
commit-push-pr
140.7kCommit, push, and open a PR
