2012-09-16 17:46:53 +00:00
|
|
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
|
|
|
|
2012-11-13 01:42:30 +00:00
|
|
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
2012-09-16 17:46:53 +00:00
|
|
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
|
|
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
|
|
import org.bukkit.ChatColor;
|
2012-09-16 18:20:51 +00:00
|
|
|
import org.bukkit.GameMode;
|
2012-09-16 17:46:53 +00:00
|
|
|
import org.bukkit.Location;
|
2012-09-16 18:20:51 +00:00
|
|
|
import org.bukkit.World;
|
2012-09-16 17:46:53 +00:00
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
|
|
|
// readded by JeromSar
|
|
|
|
public class Command_smite extends TFM_Command
|
|
|
|
{
|
2012-09-16 18:20:51 +00:00
|
|
|
@Override
|
|
|
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
2012-09-16 17:46:53 +00:00
|
|
|
{
|
2012-09-16 21:33:26 +00:00
|
|
|
if (args.length != 1)
|
2012-09-16 18:20:51 +00:00
|
|
|
{
|
2012-09-16 21:33:26 +00:00
|
|
|
return false;
|
2012-09-16 18:20:51 +00:00
|
|
|
}
|
|
|
|
|
2012-11-13 01:42:30 +00:00
|
|
|
if (!TFM_SuperadminList.isUserSuperadmin(sender))
|
2012-09-16 18:20:51 +00:00
|
|
|
{
|
2012-09-16 21:33:26 +00:00
|
|
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
|
|
|
return true;
|
2012-09-16 18:20:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Player p;
|
2012-09-16 17:46:53 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
p = getPlayer(args[0]);
|
|
|
|
}
|
|
|
|
catch (CantFindPlayerException ex)
|
|
|
|
{
|
|
|
|
sender.sendMessage(ex.getMessage());
|
|
|
|
return true;
|
|
|
|
}
|
2012-09-16 18:20:51 +00:00
|
|
|
|
|
|
|
TFM_Util.bcastMsg(p.getName() + " has been a naughty, naughty boy.", ChatColor.RED);
|
|
|
|
|
|
|
|
//Deop
|
2012-09-16 17:46:53 +00:00
|
|
|
p.setOp(false);
|
2012-09-16 18:20:51 +00:00
|
|
|
|
|
|
|
//Set gamemode to survival:
|
|
|
|
p.setGameMode(GameMode.SURVIVAL);
|
|
|
|
|
|
|
|
//Clear inventory:
|
|
|
|
p.getInventory().clear();
|
|
|
|
|
|
|
|
//Strike with lightning effect:
|
|
|
|
final Location target_pos = p.getLocation();
|
|
|
|
final World world = p.getWorld();
|
|
|
|
for (int x = -1; x <= 1; x++)
|
|
|
|
{
|
|
|
|
for (int z = -1; z <= 1; z++)
|
|
|
|
{
|
|
|
|
final Location strike_pos = new Location(world, target_pos.getBlockX() + x, target_pos.getBlockY(), target_pos.getBlockZ() + z);
|
|
|
|
world.strikeLightning(strike_pos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Kill:
|
2012-09-16 17:46:53 +00:00
|
|
|
p.setHealth(0);
|
2012-09-16 18:20:51 +00:00
|
|
|
|
|
|
|
return true;
|
2012-09-16 17:46:53 +00:00
|
|
|
}
|
|
|
|
}
|