This commit is contained in:
drtshock 2015-04-14 23:06:16 -05:00
parent ad13062117
commit dde0b20775
380 changed files with 38917 additions and 46821 deletions

View file

@ -1,52 +1,45 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n.tl;
import com.earth2me.essentials.User;
import org.bukkit.Server;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent;
import static com.earth2me.essentials.I18n.tl;
public class Commandkill extends EssentialsLoopCommand
{
public Commandkill()
{
super("kill");
}
@Override
public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
public class Commandkill extends EssentialsLoopCommand {
public Commandkill() {
super("kill");
}
loopOnlinePlayers(server, sender, true, true, args[0], null);
}
@Override
public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
if (args.length < 1) {
throw new NotEnoughArgumentsException();
}
@Override
protected void updatePlayer(final Server server, final CommandSource sender, final User user, final String[] args) throws PlayerExemptException
{
final Player matchPlayer = user.getBase();
if (sender.isPlayer() && user.isAuthorized("essentials.kill.exempt") && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.kill.force"))
{
throw new PlayerExemptException(tl("killExempt", matchPlayer.getDisplayName()));
}
final EntityDamageEvent ede = new EntityDamageEvent(matchPlayer, sender.isPlayer() && sender.getPlayer().getName().equals(matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, Short.MAX_VALUE);
server.getPluginManager().callEvent(ede);
if (ede.isCancelled() && sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.kill.force"))
{
return;
}
matchPlayer.damage(Short.MAX_VALUE);
loopOnlinePlayers(server, sender, true, true, args[0], null);
}
if (matchPlayer.getHealth() > 0)
{
matchPlayer.setHealth(0);
}
@Override
protected void updatePlayer(final Server server, final CommandSource sender, final User user, final String[] args) throws PlayerExemptException {
final Player matchPlayer = user.getBase();
if (sender.isPlayer() && user.isAuthorized("essentials.kill.exempt") && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.kill.force")) {
throw new PlayerExemptException(tl("killExempt", matchPlayer.getDisplayName()));
}
final EntityDamageEvent ede = new EntityDamageEvent(matchPlayer, sender.isPlayer() && sender.getPlayer().getName().equals(matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, Short.MAX_VALUE);
server.getPluginManager().callEvent(ede);
if (ede.isCancelled() && sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.kill.force")) {
return;
}
matchPlayer.damage(Short.MAX_VALUE);
sender.sendMessage(tl("kill", matchPlayer.getDisplayName()));
}
if (matchPlayer.getHealth() > 0) {
matchPlayer.setHealth(0);
}
sender.sendMessage(tl("kill", matchPlayer.getDisplayName()));
}
}