Fix pull request of damage request

This commit is contained in:
snowleo 2011-10-09 16:43:58 +02:00
parent 8fe0887141
commit 5984cd5835

View File

@ -4,6 +4,7 @@ import com.earth2me.essentials.Util;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent;
public class Commandkill extends EssentialsCommand public class Commandkill extends EssentialsCommand
@ -23,9 +24,12 @@ public class Commandkill extends EssentialsCommand
for (Player p : server.matchPlayer(args[0])) for (Player p : server.matchPlayer(args[0]))
{ {
EntityDamageEvent ede = new EntityDamageEvent(p, EntityDamageEvent.DamageCause.CUSTOM, 1000); final EntityDamageEvent ede = new EntityDamageEvent(p, sender instanceof Player && ((Player)sender).getName().equals(p.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, 1000);
server.getPluginManager().callEvent(ede); server.getPluginManager().callEvent(ede);
//if (ede.isCancelled()) return; if (ede.isCancelled() && !sender.hasPermission("essentials.kill.force"))
{
continue;
}
p.setHealth(0); p.setHealth(0);
sender.sendMessage(Util.format("kill", p.getDisplayName())); sender.sendMessage(Util.format("kill", p.getDisplayName()));