StopCommand.java 837 Bytes
Newer Older
KingRainbow44's avatar
KingRainbow44 committed
1
2
3
4
5
package emu.grasscutter.command.commands;

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

import java.util.List;

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

KingRainbow44's avatar
KingRainbow44 committed
12
13
14
15
16
@Command(label = "stop", usage = "stop",
        description = "Stops the server", permission = "server.stop")
public final class StopCommand implements CommandHandler {

    @Override
AnimeGitB's avatar
AnimeGitB committed
17
    public void execute(Player sender, Player targetPlayer, List<String> args) {
18
        CommandHandler.sendMessage(null, translate("commands.stop.success"));
19
        for (Player p : Grasscutter.getGameServer().getPlayers().values()) {
20
            CommandHandler.sendMessage(p, translate("commands.stop.success"));
KingRainbow44's avatar
KingRainbow44 committed
21
22
        }

23
        System.exit(1000);
KingRainbow44's avatar
KingRainbow44 committed
24
25
    }
}