TotalFreedomMod/src/me/StevenLawson/TotalFreedomMod/Commands/Command_doom.java

105 lines
3.2 KiB
Java
Raw Normal View History

2012-09-17 14:06:27 +00:00
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
2012-09-17 14:06:27 +00:00
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
2012-09-17 14:06:27 +00:00
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE)
@CommandParameters(description = "For the bad Superadmins.", usage = "/<command> <playername>")
2012-09-17 14:06:27 +00:00
public class Command_doom extends TFM_Command
{
@Override
public boolean run(final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length != 1)
{
return false;
}
2013-08-14 14:01:42 +00:00
final Player player;
try
{
2013-08-14 14:01:42 +00:00
player = getPlayer(args[0]);
}
catch (PlayerNotFoundException ex)
{
sender.sendMessage(ex.getMessage());
return true;
}
2013-08-14 14:01:42 +00:00
TFM_Util.adminAction(sender.getName(), "Casting oblivion over " + player.getName(), true);
TFM_Util.bcastMsg(player.getName() + " will be completely obliviated!", ChatColor.RED);
2013-08-14 14:01:42 +00:00
final String IP = player.getAddress().getAddress().getHostAddress().trim();
// remove from superadmin
if (TFM_AdminList.isSuperAdmin(player))
{
2013-08-14 14:01:42 +00:00
TFM_Util.adminAction(sender.getName(), "Removing " + player.getName() + " from the superadmin list.", true);
TFM_AdminList.removeSuperadmin(player);
}
// remove from whitelist
2013-08-14 14:01:42 +00:00
player.setWhitelisted(false);
// deop
2013-08-14 14:01:42 +00:00
player.setOp(false);
// ban IP
TFM_ServerInterface.banIP(IP, null, null, null);
// ban name
2013-08-14 14:01:42 +00:00
TFM_ServerInterface.banUsername(player.getName(), null, null, null);
// set gamemode to survival
2013-08-14 14:01:42 +00:00
player.setGameMode(GameMode.SURVIVAL);
// clear inventory
2013-08-14 14:01:42 +00:00
player.closeInventory();
player.getInventory().clear();
// ignite player
2013-08-14 14:01:42 +00:00
player.setFireTicks(10000);
// generate explosion
2013-08-14 14:01:42 +00:00
player.getWorld().createExplosion(player.getLocation(), 4F);
new BukkitRunnable()
{
@Override
public void run()
{
// strike lightning
2013-08-14 14:01:42 +00:00
player.getWorld().strikeLightning(player.getLocation());
// kill (if not done already)
2013-08-14 14:01:42 +00:00
player.setHealth(0.0);
}
}.runTaskLater(plugin, 20L * 2L);
new BukkitRunnable()
{
@Override
public void run()
{
// message
2013-08-14 14:01:42 +00:00
TFM_Util.adminAction(sender.getName(), "Banning " + player.getName() + ", IP: " + IP, true);
// generate explosion
2013-08-14 14:01:42 +00:00
player.getWorld().createExplosion(player.getLocation(), 4F);
// kick player
2013-08-14 14:01:42 +00:00
player.kickPlayer(ChatColor.RED + "FUCKOFF, and get your shit together!");
}
}.runTaskLater(plugin, 20L * 3L);
return true;
}
2012-09-17 14:06:27 +00:00
}