package com.sakurarealm.playerrisk;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

public class CommandHandler implements CommandExecutor {

    private final PlayerRisk plugin;

    public CommandHandler(PlayerRisk plugin) {
        this.plugin = plugin;
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if (args.length == 0 || !sender.hasPermission("playerrisk.admin")) {
            return true;
        }

        if (args[0].equalsIgnoreCase("reload")) {
            plugin.load();
            sender.sendMessage("&aPlayerRisk plugin reloaded!");
            return true;
        }

        return true;
    }
}
