2012-09-17 14:06:27 +00:00
|
|
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
|
|
|
|
2014-04-09 20:33:03 +00:00
|
|
|
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
2014-04-14 19:11:41 +00:00
|
|
|
import me.StevenLawson.TotalFreedomMod.TFM_Ban;
|
|
|
|
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
2014-05-05 14:10:14 +00:00
|
|
|
import me.StevenLawson.TotalFreedomMod.TFM_PlayerList;
|
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;
|
2014-04-23 14:43:12 +00:00
|
|
|
import org.bukkit.util.Vector;
|
2012-09-17 14:06:27 +00:00
|
|
|
|
2015-09-06 14:42:02 +00:00
|
|
|
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
2014-04-14 19:11:41 +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;
|
|
|
|
}
|
|
|
|
|
2014-04-26 11:55:24 +00:00
|
|
|
final Player player = getPlayer(args[0]);
|
2014-05-04 21:03:34 +00:00
|
|
|
|
2014-04-26 11:55:24 +00:00
|
|
|
if (player == null)
|
2012-09-17 23:46:59 +00:00
|
|
|
{
|
2014-08-23 18:19:25 +00:00
|
|
|
sender.sendMessage(TFM_Command.PLAYER_NOT_FOUND);
|
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
|
|
|
|
2014-04-14 19:11:41 +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
|
|
|
|
2014-05-05 14:10:14 +00:00
|
|
|
// ban IPs
|
2014-05-19 17:32:25 +00:00
|
|
|
for (String playerIp : TFM_PlayerList.getEntry(player).getIps())
|
2014-05-05 14:10:14 +00:00
|
|
|
{
|
2014-05-19 17:32:25 +00:00
|
|
|
TFM_BanManager.addIpBan(new TFM_Ban(playerIp, player.getName()));
|
2014-05-05 14:10:14 +00:00
|
|
|
}
|
2012-09-17 23:46:59 +00:00
|
|
|
|
2014-06-29 08:53:39 +00:00
|
|
|
// ban uuid
|
|
|
|
TFM_BanManager.addUuidBan(player);
|
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
|
|
|
|
2014-04-23 14:43:12 +00:00
|
|
|
// Shoot the player in the sky
|
|
|
|
player.setVelocity(player.getVelocity().clone().add(new Vector(0, 20, 0)));
|
|
|
|
|
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
|
|
|
}
|
2014-04-23 14:43:12 +00:00
|
|
|
}.runTaskLater(plugin, 2L * 20L);
|
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
|
2014-04-14 19:11:41 +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
|
|
|
}
|
2014-04-23 14:43:12 +00:00
|
|
|
}.runTaskLater(plugin, 3L * 20L);
|
2012-09-17 23:46:59 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2012-09-17 14:06:27 +00:00
|
|
|
}
|