2016-07-01 16:15:42 +02:00
|
|
|
/*
|
2022-01-08 23:02:57 +01:00
|
|
|
* Copyright (C) 2012-2022 Frank Baumann
|
2016-07-01 16:15:42 +02:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2018-05-03 21:54:25 +02:00
|
|
|
package de.erethon.dungeonsxl.command;
|
2016-07-01 16:15:42 +02:00
|
|
|
|
2018-08-18 16:52:51 +02:00
|
|
|
import de.erethon.dungeonsxl.DungeonsXL;
|
2018-05-03 21:54:25 +02:00
|
|
|
import de.erethon.dungeonsxl.config.DMessage;
|
|
|
|
import de.erethon.dungeonsxl.player.DPermission;
|
2022-04-03 18:09:12 +02:00
|
|
|
import de.erethon.bedrock.chat.MessageUtil;
|
2016-07-01 16:15:42 +02:00
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Frank Baumann, Daniel Saukel
|
|
|
|
*/
|
2018-08-18 16:52:51 +02:00
|
|
|
public class KickCommand extends DCommand {
|
2016-07-01 16:15:42 +02:00
|
|
|
|
2018-08-18 16:52:51 +02:00
|
|
|
public KickCommand(DungeonsXL plugin) {
|
|
|
|
super(plugin);
|
2016-07-01 16:15:42 +02:00
|
|
|
setCommand("kick");
|
|
|
|
setMinArgs(1);
|
|
|
|
setMaxArgs(1);
|
2020-02-02 03:03:29 +01:00
|
|
|
setHelp(DMessage.CMD_KICK_HELP.getMessage());
|
2017-11-16 18:25:10 +01:00
|
|
|
setPermission(DPermission.KICK.getNode());
|
2016-07-01 16:15:42 +02:00
|
|
|
setPlayerCommand(true);
|
2016-12-27 00:49:17 +01:00
|
|
|
setConsoleCommand(true);
|
2016-07-01 16:15:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onExecute(String[] args, CommandSender sender) {
|
|
|
|
Player player = Bukkit.getPlayer(args[1]);
|
|
|
|
|
|
|
|
if (player != null) {
|
2018-08-18 16:52:51 +02:00
|
|
|
plugin.getCommandCache().leave.onExecute(new String[]{plugin.getCommandCache().leave.getCommand()}, player);
|
2017-07-21 18:33:21 +02:00
|
|
|
MessageUtil.sendMessage(sender, DMessage.CMD_KICK_SUCCESS.getMessage(player.getName()));
|
2016-07-01 16:15:42 +02:00
|
|
|
|
|
|
|
} else {
|
2017-07-21 18:33:21 +02:00
|
|
|
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_SUCH_PLAYER.getMessage(args[1]));
|
2016-07-01 16:15:42 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|