1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-23 23:03:05 +02:00

Revert "We can't damage and kill, so we will just kill to make everyone happy, and the event pointless."

This reverts commit d54a1bb9bd.

Also fix kill to do the same.
This commit is contained in:
KHobbits
2012-05-06 16:09:47 +01:00
parent d54a1bb9bd
commit 2cf1fae209
2 changed files with 6 additions and 4 deletions

View File

@@ -24,15 +24,14 @@ public class Commandkill extends EssentialsCommand
for (Player matchPlayer : server.matchPlayer(args[0]))
{
final EntityDamageEvent ede = new EntityDamageEvent(matchPlayer, sender instanceof Player && ((Player)sender).getName().equals(matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, 1000);
final EntityDamageEvent ede = new EntityDamageEvent(matchPlayer, sender instanceof Player && ((Player)sender).getName().equals(matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, Short.MAX_VALUE);
server.getPluginManager().callEvent(ede);
if (ede.isCancelled() && !sender.hasPermission("essentials.kill.force"))
{
continue;
}
matchPlayer.damage(1000);
matchPlayer.setHealth(0);
matchPlayer.damage(Short.MAX_VALUE);
sender.sendMessage(_("kill", matchPlayer.getDisplayName()));
}
}

View File

@@ -3,6 +3,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import org.bukkit.Server;
import org.bukkit.event.entity.EntityDamageEvent;
public class Commandsuicide extends EssentialsCommand
@@ -15,7 +16,9 @@ public class Commandsuicide extends EssentialsCommand
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
user.setHealth(0);
EntityDamageEvent ede = new EntityDamageEvent(user.getBase(), EntityDamageEvent.DamageCause.SUICIDE, Short.MAX_VALUE);
server.getPluginManager().callEvent(ede);
user.damage(Short.MAX_VALUE);
user.sendMessage(_("suicideMessage"));
user.setDisplayNick();
ess.broadcastMessage(user,_("suicideSuccess", user.getDisplayName()));