All Git Basic Function

This commit is contained in:
Muhammad Tamir
2025-06-19 19:22:48 +07:00
parent 19676c31bb
commit baa3a41ba2
18 changed files with 777 additions and 6 deletions

View File

@@ -0,0 +1,44 @@
package org.yuemi.commands;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import org.yuemi.commands.subcommands.GitAddSubcommand;
import org.yuemi.commands.subcommands.GitCommitSubcommand;
import org.yuemi.commands.subcommands.GitPushSubcommand;
import org.yuemi.commands.subcommands.GitResetSubcommand;
import org.yuemi.commands.subcommands.GitInitSubcommand;
import org.yuemi.commands.subcommands.GitRemoteSubcommand;
import org.yuemi.commands.subcommands.GitFetchSubcommand;
import org.yuemi.commands.subcommands.GitPullSubcommand;
import org.yuemi.commands.subcommands.GitStatusSubcommand;
import org.yuemi.commands.subcommands.GitHelpSubcommand;
import java.util.HashMap;
import java.util.Map;
public class SubcommandHandler {
private final Map<String, SubcommandExecutor> commands = new HashMap<>();
public SubcommandHandler(JavaPlugin plugin) {
commands.put("add", new GitAddSubcommand(plugin));
commands.put("commit", new GitCommitSubcommand(plugin));
commands.put("push", new GitPushSubcommand(plugin));
commands.put("reset", new GitResetSubcommand(plugin));
commands.put("init", new GitInitSubcommand(plugin));
commands.put("remote", new GitRemoteSubcommand(plugin));
commands.put("fetch", new GitFetchSubcommand(plugin));
commands.put("pull", new GitPullSubcommand(plugin));
commands.put("status", new GitStatusSubcommand(plugin));
commands.put("help", new GitHelpSubcommand(plugin));
}
public void handle(CommandSender sender, String name, String[] args) {
SubcommandExecutor executor = commands.get(name.toLowerCase());
if (executor == null) {
sender.sendMessage("§cUnknown subcommand: " + name);
return;
}
executor.execute(sender, args);
}
}