added /doom

This commit is contained in:
Jerom van der Sar 2012-09-17 16:06:27 +02:00
parent 90e696a5b0
commit 8c38344c99
2 changed files with 112 additions and 1 deletions

View File

@ -0,0 +1,108 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
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(!(TFM_Util.isUserSuperadmin(sender)))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
if(args.length != 1)
{
return false;
}
final Player p;
try
{
p = getPlayer(args[0]);
}
catch(CantFindPlayerException ex)
{
sender.sendMessage(ex.getMessage());
return true;
}
TFM_Util.adminAction(sender.getName(), "Casting oblivion over " + p.getName(), true);
TFM_Util.bcastMsg(p.getName() + " will be completely obliveriated!", ChatColor.RED);
final String IP = p.getAddress().getAddress().getHostAddress().trim();
// remove from superadmin
if(TFM_Util.isUserSuperadmin(p))
{
server.dispatchCommand(sender, "saconfig delete " + p.getName());
}
// remove from whitelist
p.setWhitelisted(false);
// deop
p.setOp(false);
// ban IP
Bukkit.banIP(IP);
// ban name
p.setBanned(true);
// set gamemode to survival
p.setGameMode(GameMode.SURVIVAL);
// clear inventory
p.closeInventory();
p.getInventory().clear();
// ignite player
p.setFireTicks(10000);
// generate explosion
p.getWorld().createExplosion(p.getLocation(), 4F);
server.getScheduler().scheduleAsyncDelayedTask(plugin, new Runnable()
{
@Override
public void run() {
// strike lightning
p.getWorld().strikeLightning(p.getLocation());
// kill (if not done already)
p.setHealth(0);
}
}, 40L); // 2 seconds
server.getScheduler().scheduleAsyncDelayedTask(plugin, new Runnable()
{
@Override
public void run() {
// message
TFM_Util.adminAction(sender.getName(), "Banning " + p.getName() + ", IP: " + IP, true);
// generate explosion
p.getWorld().createExplosion(p.getLocation(), 4F);
// kick player
p.kickPlayer(ChatColor.RED + "You, my dear friend must FUCKOFF!");
}
}, 60L); // 3 seconds
return true;
}
}

View File

@ -24,13 +24,16 @@ commands:
usage: /<command> [partialname] usage: /<command> [partialname]
csay: csay:
description: Telnet command - Send a chat message with chat formatting over telnet. description: Telnet command - Send a chat message with chat formatting over telnet.
usage: /<command> [partialname] usage: /<command> <message...>
deop: deop:
description: Superadmin command - Deop a player description: Superadmin command - Deop a player
usage: /<command> <playername> usage: /<command> <playername>
deopall: deopall:
description: Superadmin command - Deop everyone on the server. description: Superadmin command - Deop everyone on the server.
usage: /<command> usage: /<command>
doom:
description: Owner command - For the worst of the worst, completely remove a player.
usage: /<command> <playername>
enchant: enchant:
description: Enchant items. description: Enchant items.
usage: /<command> <list | addall | reset | add <name> | remove <name>> usage: /<command> <list | addall | reset | add <name> | remove <name>>