mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-06 11:00:43 +01:00
Fix pull request of damage request
This commit is contained in:
parent
8fe0887141
commit
5984cd5835
@ -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()));
|
||||||
|
Loading…
Reference in New Issue
Block a user