Skip to content

hmEmmy/git-commit-fetcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

✨ Git Commit Fetcher

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.

πŸš€ Features

  • πŸ”— 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

πŸ› οΈ Setup

Update the following in CommitFetcher:

private final String REPOSITORY_OWNER = "YourGitHubUsername";  
private final String REPOSITORY_NAME = "YourRepositoryName";  

πŸ–₯️ Example Command

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;
    }
}

πŸ“¦ Dependencies

πŸ‘€ Author

Developed by Emmy πŸ’œ
Since 22/07/2025

About

Github Commit Fetcher for Minecraft Plugins.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages