mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-07-02 20:11:44 +00:00
[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:
parent
62942bdb3d
commit
547e262061
15 changed files with 19 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue