TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/Command_restart.java

35 lines
1.1 KiB
Java
Raw Normal View History

package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
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 restarts the server.", usage = "/<command>")
public class Command_restart extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
2018-07-25 02:44:00 +00:00
if (!plugin.amp.enabled)
{
msg(ChatColor.RED + "AMP integration is not enabled. Please use /stop instead.");
return true;
}
FUtil.bcastMsg("Server is going offline!", ChatColor.LIGHT_PURPLE);
for (Player player : server.getOnlinePlayers())
{
player.kickPlayer("Server is going offline, come back in about 20 seconds.");
}
plugin.amp.restartServer();
return true;
}
}