TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/Command_restart.java
Lemon 0551337e8b Implement #22 and fix pom.xml.
Signed-off-by: Lemon <minecraftoxlemonxo@gmail.com>
2018-02-22 17:55:04 +05:00

35 lines
1.1 KiB
Java

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)
{
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;
}
}