2012-09-17 14:06:27 +00:00
|
|
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
|
|
|
|
2012-12-09 03:42:29 +00:00
|
|
|
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
2014-04-09 20:33:03 +00:00
|
|
|
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;
|
2013-07-27 21:49:25 +00:00
|
|
|
import org.bukkit.scheduler.BukkitRunnable;
|
2012-09-17 14:06:27 +00:00
|
|
|
|
2013-03-19 22:05:20 +00:00
|
|
|
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE)
|
2013-04-10 02:05:24 +00:00
|
|
|
@CommandParameters(description = "For the bad Superadmins.", usage = "/<command> <playername>")
|
2012-09-17 14:06:27 +00:00
|
|
|
public class Command_doom extends TFM_Command
|
|
|
|
{
|
2012-09-17 23:46:59 +00:00
|
|
|
@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;
|
2012-09-17 23:46:59 +00:00
|
|
|
try
|
|
|
|
{
|
2013-08-14 14:01:42 +00:00
|
|
|
player = getPlayer(args[0]);
|
2012-09-17 23:46:59 +00:00
|
|
|
}
|
2013-08-14 13:28:19 +00:00
|
|
|
catch (PlayerNotFoundException ex)
|
2012-09-17 23:46:59 +00:00
|
|
|
{
|
2013-08-14 13:28:19 +00:00
|
|
|
sender.sendMessage(ex.getMessage());
|
2012-09-17 23:46:59 +00:00
|
|
|
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);
|
2012-09-17 23:46:59 +00:00
|
|
|
|
2013-08-14 14:01:42 +00:00
|
|
|
final String IP = player.getAddress().getAddress().getHostAddress().trim();
|
2012-09-17 23:46:59 +00:00
|
|
|
|
|
|
|
// remove from superadmin
|
2014-04-09 20:33:03 +00:00
|
|
|
if (TFM_AdminList.isSuperAdmin(player))
|
2012-09-17 23:46:59 +00:00
|
|
|
{
|
2013-08-14 14:01:42 +00:00
|
|
|
TFM_Util.adminAction(sender.getName(), "Removing " + player.getName() + " from the superadmin list.", true);
|
2014-04-09 20:33:03 +00:00
|
|
|
TFM_AdminList.removeSuperadmin(player);
|
2012-09-17 23:46:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// remove from whitelist
|
2013-08-14 14:01:42 +00:00
|
|
|
player.setWhitelisted(false);
|
2012-09-17 23:46:59 +00:00
|
|
|
|
|
|
|
// deop
|
2013-08-14 14:01:42 +00:00
|
|
|
player.setOp(false);
|
2012-09-17 23:46:59 +00:00
|
|
|
|
|
|
|
// ban IP
|
2012-12-09 03:42:29 +00:00
|
|
|
TFM_ServerInterface.banIP(IP, null, null, null);
|
2012-09-17 23:46:59 +00:00
|
|
|
|
|
|
|
// ban name
|
2013-08-14 14:01:42 +00:00
|
|
|
TFM_ServerInterface.banUsername(player.getName(), null, null, null);
|
2012-09-17 23:46:59 +00:00
|
|
|
|
|
|
|
// set gamemode to survival
|
2013-08-14 14:01:42 +00:00
|
|
|
player.setGameMode(GameMode.SURVIVAL);
|
2012-09-17 23:46:59 +00:00
|
|
|
|
|
|
|
// clear inventory
|
2013-08-14 14:01:42 +00:00
|
|
|
player.closeInventory();
|
|
|
|
player.getInventory().clear();
|
2012-09-17 23:46:59 +00:00
|
|
|
|
|
|
|
// ignite player
|
2013-08-14 14:01:42 +00:00
|
|
|
player.setFireTicks(10000);
|
2012-09-17 23:46:59 +00:00
|
|
|
|
|
|
|
// generate explosion
|
2013-08-14 14:01:42 +00:00
|
|
|
player.getWorld().createExplosion(player.getLocation(), 4F);
|
2012-09-17 23:46:59 +00:00
|
|
|
|
2013-07-27 21:49:25 +00:00
|
|
|
new BukkitRunnable()
|
2012-09-17 23:46:59 +00:00
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
// strike lightning
|
2013-08-14 14:01:42 +00:00
|
|
|
player.getWorld().strikeLightning(player.getLocation());
|
2012-09-17 23:46:59 +00:00
|
|
|
|
|
|
|
// kill (if not done already)
|
2013-08-14 14:01:42 +00:00
|
|
|
player.setHealth(0.0);
|
2012-09-17 23:46:59 +00:00
|
|
|
}
|
2013-07-27 21:49:25 +00:00
|
|
|
}.runTaskLater(plugin, 20L * 2L);
|
2012-09-17 23:46:59 +00:00
|
|
|
|
2013-07-27 21:49:25 +00:00
|
|
|
new BukkitRunnable()
|
2012-09-17 23:46:59 +00:00
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
// message
|
2013-08-14 14:01:42 +00:00
|
|
|
TFM_Util.adminAction(sender.getName(), "Banning " + player.getName() + ", IP: " + IP, true);
|
2012-09-17 23:46:59 +00:00
|
|
|
|
|
|
|
// generate explosion
|
2013-08-14 14:01:42 +00:00
|
|
|
player.getWorld().createExplosion(player.getLocation(), 4F);
|
2012-09-17 23:46:59 +00:00
|
|
|
|
|
|
|
// kick player
|
2013-08-14 14:01:42 +00:00
|
|
|
player.kickPlayer(ChatColor.RED + "FUCKOFF, and get your shit together!");
|
2012-09-17 23:46:59 +00:00
|
|
|
}
|
2013-07-27 21:49:25 +00:00
|
|
|
}.runTaskLater(plugin, 20L * 3L);
|
2012-09-17 23:46:59 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2012-09-17 14:06:27 +00:00
|
|
|
}
|