TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stop.java
Robinson Gallego ae1701613b ok fixed some bugs
Signed-off-by: Robinson Gallego <robinson.leal7@gmail.com>
2019-07-31 12:19:23 -04:00

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.lang.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;
}
}