Quick Start
Learn the basics of NextLib in 5 minutes
Your First Plugin
MyPlugin.java
import io.github.chi2l3s.nextlib.api.command.CommandRegistry;
import io.github.chi2l3s.nextlib.api.command.LongCommandExecutor;
import io.github.chi2l3s.nextlib.api.command.SubCommand;
import io.github.chi2l3s.nextlib.api.color.ColorUtil;
import io.github.chi2l3s.nextlib.api.color.ColorUtilImpl;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.Permission;
import org.bukkit.plugin.java.JavaPlugin;
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
// Register root command with a subcommand
new CommandRegistry(this).registerCommand("hello", new HelloCommand());
getLogger().info("MyPlugin enabled!");
}
static class HelloCommand extends LongCommandExecutor {
private final ColorUtil color = new ColorUtilImpl();
HelloCommand() {
addSubCommand(new SubCommand() {
public void onExecute(CommandSender sender, String[] args) {
sender.sendMessage(color.formatMessage("&a&lHello World!"));
}
public java.util.List<String> onTabComplete(CommandSender s, String[] a) {
return java.util.List.of();
}
}, new String[]{"run"}, new Permission("hello.use"));
}
}
}What's Next?
- Explore the Color API for advanced text formatting
- Learn about the Command API for complex command handling
- Check out the Item API for custom items