Untitled

mail@pastecode.io avatar
unknown
java
2 years ago
1.6 kB
2
Indexable
Never
package net.hollowrealms.duels.subcommands;

import com.sun.net.httpserver.Request;

import net.hollowrealms.HollowRealmsCore;
import net.hollowrealms.commands.SubCommand;
import net.hollowrealms.request.RequestManager;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import java.util.List;
import java.util.UUID;

import static net.hollowrealms.util.ColorTranslator.translateColorCodes;

public class DuelInvite extends SubCommand {


    @Override
    public String getName() {
        return "invite";
    }

    @Override
    public String getDescription() {
        return "Invite a player to duel";
    }

    @Override
    public String getSyntax() {
        return "/duel invite <player>";
    }


    @Override
    public void execute(Player sender, String[] args) {
        RequestManager requestManager = new RequestManager(HollowRealmsCore.getInstance());

        if (args.length < 2) {
            sender.sendMessage(translateColorCodes("&cPlease provide a player to invite"));
        } else {
            String playerName = args[1];


            Player target = Bukkit.getServer().getPlayerExact(playerName);

            if (target == null) {
                sender.sendMessage(translateColorCodes("&cPlayer not Found (are they online?)"));
            } else {
                //check if same race once race is set up
                requestManager.send(sender, target);

            }


        }
    }
    @Override
    public List<String> getSubCommandArgs(Player player, String[] args) {
        return null;
    }
}