[FEATURE] Add kill exempt :: new permission: essentials.kill.exempt

players with essentials.kill.force and console will still be able to override this
This commit is contained in:
Iaccidentally 2013-04-19 14:40:10 -04:00
parent 62942bdb3d
commit 547e262061
15 changed files with 19 additions and 1 deletions

View file

@ -32,12 +32,16 @@ public class Commandkill extends EssentialsCommand
final List<Player> matchedPlayers = server.matchPlayer(args[0]);
for (Player matchPlayer : matchedPlayers)
{
if (ess.getUser(matchPlayer).isAuthorized("essentials.kill.exempt") && !ess.getUser(sender).isAuthorized("essentials.kill.force"))
{
throw new Exception(_("killExempt", matchPlayer.getDisplayName()));
}
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 instanceof Player && !ess.getUser(sender).isAuthorized("essentials.kill.force"))
{
continue;
}
}
matchPlayer.damage(Short.MAX_VALUE);
if (matchPlayer.getHealth() > 0)