Newer
Older
ChallengeSystem / src / main / java / de / fanta / challenges / commands / LeaveCommand.java
@fanta fanta on 30 Jul 2022 966 bytes challenges ban command
package de.fanta.challenges.commands;

import de.fanta.challenges.Challenges;
import de.fanta.challenges.ServerType;
import de.fanta.challenges.utils.ChatUtil;
import de.iani.cubesideutils.bukkit.commands.SubCommand;
import de.iani.cubesideutils.commands.ArgsParser;
import de.speedy64.globalport.GlobalApi;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class LeaveCommand extends SubCommand {

    private final Challenges plugin;

    public LeaveCommand(Challenges plugin) {
        this.plugin = plugin;
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String alias, String commandString, ArgsParser args) {
        if (!(sender instanceof Player p)) {
            ChatUtil.sendErrorMessage(sender, "You are not a Player :>");
            return true;
        } else {
            plugin.portPlayerToLobby(p);
        }
        return true;
    }

}