A lightweight GitHub commit fetcher for Minecraft plugins (Spigot/Paper/Bukkit).
This utility lets you fetch and display recent Git commits directly in-game, with author, date, and summary info. Perfect for showing recent updates, patch notes, or changelogs.
- π Fetches commit history from any public GitHub repository
- π Displays commits with author, date, and summary
- π¨ Supports Minecraft color codes
- β‘ Runs asynchronously (non-blocking)
- π Clean shutdown with executor cleanup
Update the following in CommitFetcher:
private final String REPOSITORY_OWNER = "YourGitHubUsername";
private final String REPOSITORY_NAME = "YourRepositoryName"; package me.emmy.command;
import me.emmy.api.CommitFetcher;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
public class UpdatesCommand implements CommandExecutor {
private final CommitFetcher commitFetcher = new CommitFetcher();
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length < 1) {
sender.sendMessage(ChatColor.RED + "Usage: /updates <amount>");
return true;
}
int requestedAmount;
try {
requestedAmount = Integer.parseInt(args[0]);
if (requestedAmount < 1 || requestedAmount > commitFetcher.getMAX_FETCH_LIMIT()) {
sender.sendMessage(ChatColor.RED + "Please specify a number between 1 and " + commitFetcher.getMAX_FETCH_LIMIT() + ".");
return true;
}
} catch (NumberFormatException exception) {
sender.sendMessage(ChatColor.RED + "Invalid number format. Please enter a valid integer.");
return true;
}
sender.sendMessage(ChatColor.YELLOW + "Fetching recent updates for " + commitFetcher.getREPOSITORY_NAME() + "...");
Future<List<String>> futureCommits = commitFetcher.fetchAndFormatCommitsAsync(requestedAmount);
try {
List<String> formattedCommitMessages = futureCommits.get();
if (formattedCommitMessages.isEmpty()) {
sender.sendMessage(ChatColor.RED + "No recent updates found.");
return true;
}
for (String message : formattedCommitMessages) {
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', message));
}
} catch (InterruptedException | ExecutionException exception) {
sender.sendMessage(ChatColor.RED + "An error occurred while fetching updates. Please try again later.");
}
return true;
}
}Developed by Emmy π
Since 22/07/2025