Copied over the old Essentials logic for smite and added it to the yml.

ALLMAN!
This commit is contained in:
Steven Lawson 2012-09-16 14:20:51 -04:00
parent 1182c0b3bb
commit 90e696a5b0
2 changed files with 44 additions and 29 deletions

View File

@ -2,31 +2,31 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
// readded by JeromSar // readded by JeromSar
public class Command_smite extends TFM_Command public class Command_smite extends TFM_Command
{ {
@Override @Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{ {
if(!TFM_Util.isUserSuperadmin(sender)) if (!TFM_Util.isUserSuperadmin(sender))
{ {
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS); sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
} }
if(args.length != 1) if (args.length != 1)
{ {
return false; return false;
} }
Player p; Player p;
try try
{ {
p = getPlayer(args[0]); p = getPlayer(args[0]);
@ -37,20 +37,32 @@ public class Command_smite extends TFM_Command
return true; return true;
} }
TFM_Util.bcastMsg(p.getName() + " has been a naughty, naughty boy", ChatColor.RED); TFM_Util.bcastMsg(p.getName() + " has been a naughty, naughty boy.", ChatColor.RED);
Location loc = p.getLocation(); //Deop
p.getInventory().clear();
p.setOp(false); p.setOp(false);
// lighting thrice, just because we can :) //Set gamemode to survival:
p.getWorld().strikeLightning(loc); p.setGameMode(GameMode.SURVIVAL);
p.getWorld().strikeLightning(loc);
p.getWorld().strikeLightning(loc);
//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:
p.setHealth(0); p.setHealth(0);
return true; return true;
} }
} }

View File

@ -151,6 +151,9 @@ commands:
setspawnworld: setspawnworld:
description: Superadmin Command - Set world spawnpoint. description: Superadmin Command - Set world spawnpoint.
usage: /<command> usage: /<command>
smite:
description: Superadmin Command - Someone being a little bitch? Smite them down...
usage: /<command> [playername]
ender: ender:
description: Goto the ender / "The End". description: Goto the ender / "The End".
usage: /<command> usage: /<command>