From 90e696a5b0d3a88169aa2325837ad95e41a44a17 Mon Sep 17 00:00:00 2001 From: Steven Lawson Date: Sun, 16 Sep 2012 14:20:51 -0400 Subject: [PATCH] Copied over the old Essentials logic for smite and added it to the yml. ALLMAN! --- .../Commands/Command_smite.java | 70 +++++++++++-------- src/plugin.yml | 3 + 2 files changed, 44 insertions(+), 29 deletions(-) diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_smite.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_smite.java index 433da4aa..6f81db70 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_smite.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_smite.java @@ -2,31 +2,31 @@ package me.StevenLawson.TotalFreedomMod.Commands; import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; - import org.bukkit.ChatColor; +import org.bukkit.GameMode; import org.bukkit.Location; +import org.bukkit.World; 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 { - @Override - public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) + @Override + public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - if(!TFM_Util.isUserSuperadmin(sender)) - { - sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS); - } - - if(args.length != 1) - { - return false; - } - - Player p; + if (!TFM_Util.isUserSuperadmin(sender)) + { + sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS); + } + + if (args.length != 1) + { + return false; + } + + Player p; try { p = getPlayer(args[0]); @@ -36,21 +36,33 @@ public class Command_smite extends TFM_Command sender.sendMessage(ex.getMessage()); return true; } - - TFM_Util.bcastMsg(p.getName() + " has been a naughty, naughty boy", ChatColor.RED); - - Location loc = p.getLocation(); - - p.getInventory().clear(); + + TFM_Util.bcastMsg(p.getName() + " has been a naughty, naughty boy.", ChatColor.RED); + + //Deop p.setOp(false); - - // lighting thrice, just because we can :) - p.getWorld().strikeLightning(loc); - p.getWorld().strikeLightning(loc); - p.getWorld().strikeLightning(loc); - + + //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: p.setHealth(0); - - return true; + + return true; } } diff --git a/src/plugin.yml b/src/plugin.yml index dd2ea003..1e7bf4b6 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -151,6 +151,9 @@ commands: setspawnworld: description: Superadmin Command - Set world spawnpoint. usage: / + smite: + description: Superadmin Command - Someone being a little bitch? Smite them down... + usage: / [playername] ender: description: Goto the ender / "The End". usage: /