Package com.zack6849.alphabot.commands

Source Code of com.zack6849.alphabot.commands.Unban

/*
*    This file is part of Alphabot.
*
*    Alphabot is free software: you can redistribute it and/or modify
*    it under the terms of the GNU Lesser General Public License as published by
*    the Free Software Foundation, either version 3 of the License, or
*    (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU Lesser General Public License for more details.
*
*    You should have received a copy of the GNU Lesser General Public License
*    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
*/


package com.zack6849.alphabot.commands;

import com.zack6849.alphabot.api.Command;
import com.zack6849.alphabot.api.Config;
import com.zack6849.alphabot.api.PermissionManager;
import org.pircbotx.Channel;
import org.pircbotx.User;
import org.pircbotx.hooks.events.MessageEvent;

public class Unban extends Command {

    private Config config;
    private PermissionManager manager;

    public Unban() {
        super("Unban", "Removes a ban on a hostmask", "Unban hostmask or Unban #channel hostmask");
    }

    //huehuehue le copypasta faec
    @Override
    public boolean execute(MessageEvent event) {
        String[] args = event.getMessage().split(" ");
        User sender = event.getUser();
        if (args.length == 3) {
            Channel target = event.getBot().getUserChannelDao().getChannel(args[1]);
            //target.send().unBan();
            target.send().ban(args[2]);
            return true;
        }
        if (args.length == 2) {
            event.getChannel().send().ban(args[1]);
            return true;
        }
        return false;
    }

    @Override
    public void setConfig(Config config) {
        this.config = config;
    }

    @Override
    public void setManager(PermissionManager manager) {
        this.manager = manager;
    }
}
TOP

Related Classes of com.zack6849.alphabot.commands.Unban

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.