package net.knarcraft.blacksmith.command;

import net.knarcraft.blacksmith.BlacksmithPlugin;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.List;

import static net.knarcraft.blacksmith.util.MessageFormatter.displaySuccessMessage;

/**
 * The command for re-loading the plugin
 */
public class ReloadCommand implements TabExecutor {

    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label,
                             @NotNull String[] args) {
        BlacksmithPlugin.getInstance().reload();
        displaySuccessMessage(sender, "Blacksmith config reloaded!");
        return true;
    }

    @Nullable
    @Override
    public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label,
                                      @NotNull String[] args) {
        return new ArrayList<>();
    }

}
