mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-11-05 09:09:40 +01:00
Check if at least one of the people fighting is human
This commit is contained in:
parent
7f2de5194f
commit
dd3017b0f9
@ -25,10 +25,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.Projectile;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -202,18 +199,22 @@ public class DisguiseListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
public void onAttack(EntityDamageByEntityEvent event) {
|
public void onAttack(EntityDamageByEntityEvent event) {
|
||||||
if (event.getEntity() instanceof Player) {
|
|
||||||
if (DisguiseConfig.isDisguiseBlownWhenAttacked()) {
|
|
||||||
checkPlayerCanBlowDisguise((Player) event.getEntity());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Entity attacker = event.getDamager();
|
Entity attacker = event.getDamager();
|
||||||
|
|
||||||
if (attacker instanceof Projectile && ((Projectile) attacker).getShooter() instanceof Player) {
|
if (attacker instanceof Projectile && ((Projectile) attacker).getShooter() instanceof Player) {
|
||||||
attacker = (Entity) ((Projectile) attacker).getShooter();
|
attacker = (Entity) ((Projectile) attacker).getShooter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.getEntityType() != EntityType.PLAYER && !(attacker instanceof Player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getEntity() instanceof Player) {
|
||||||
|
if (DisguiseConfig.isDisguiseBlownWhenAttacked()) {
|
||||||
|
checkPlayerCanBlowDisguise((Player) event.getEntity());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
checkPlayerCanFight(event, attacker);
|
checkPlayerCanFight(event, attacker);
|
||||||
|
|
||||||
if (attacker instanceof Player) {
|
if (attacker instanceof Player) {
|
||||||
|
Loading…
Reference in New Issue
Block a user