KickCommand.java 1.11 KB
Newer Older
KingRainbow44's avatar
KingRainbow44 committed
1
2
3
4
package emu.grasscutter.command.commands;

import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
Melledy's avatar
Melledy committed
5
import emu.grasscutter.game.player.Player;
KingRainbow44's avatar
KingRainbow44 committed
6
7
8

import java.util.List;

9
10
import static emu.grasscutter.utils.Language.translate;

11
@Command(label = "kick", usage = "kick", aliases = {"restart"}, permissionTargeted = "server.kick", description = "commands.kick.description")
KingRainbow44's avatar
KingRainbow44 committed
12
13
14
public final class KickCommand implements CommandHandler {

    @Override
AnimeGitB's avatar
AnimeGitB committed
15
    public void execute(Player sender, Player targetPlayer, List<String> args) {
KingRainbow44's avatar
KingRainbow44 committed
16
        if (sender != null) {
17
18
19
            CommandHandler.sendMessage(sender, translate(sender, "commands.kick.player_kick_player",
                Integer.toString(sender.getUid()), sender.getAccount().getUsername(),
                Integer.toString(targetPlayer.getUid()), targetPlayer.getAccount().getUsername()));
20
        } else {
Secretboy's avatar
Secretboy committed
21
            CommandHandler.sendMessage(null, translate(sender, "commands.kick.server_kick_player", Integer.toString(targetPlayer.getUid()), targetPlayer.getAccount().getUsername()));
KingRainbow44's avatar
KingRainbow44 committed
22
23
24
25
26
        }

        targetPlayer.getSession().close();
    }
}