mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Revert "We can't damage and kill, so we will just kill to make everyone happy, and the event pointless."
This reverts commit 705efc6002
.
Also fix kill to do the same.
This commit is contained in:
parent
705efc6002
commit
d3397279f6
2 changed files with 6 additions and 4 deletions
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()));
|
||||
|
|
Loading…
Reference in a new issue