mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-17 04:46:11 +00:00
38 lines
1.1 KiB
Java
38 lines
1.1 KiB
Java
package me.totalfreedom.totalfreedommod.command;
|
|
|
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.bukkit.ChatColor;
|
|
import org.bukkit.command.Command;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.entity.Player;
|
|
|
|
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
|
@CommandParameters(description = "Kicks everyone and stops the server.", usage = "/<command> [reason]")
|
|
public class Command_stop extends FreedomCommand
|
|
{
|
|
|
|
@Override
|
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
{
|
|
FUtil.bcastMsg("Server is going offline!", ChatColor.LIGHT_PURPLE);
|
|
|
|
String reason = "Server is going offline, come back in about 20 seconds.";
|
|
|
|
if (args.length > 0)
|
|
{
|
|
reason = StringUtils.join(args, " ");
|
|
}
|
|
|
|
for (Player player : server.getOnlinePlayers())
|
|
{
|
|
player.kickPlayer(reason);
|
|
}
|
|
|
|
server.shutdown();
|
|
|
|
return true;
|
|
}
|
|
}
|