mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-11-05 09:09:40 +01:00
Blow disguise for attackers as well
This commit is contained in:
parent
cb58cdd8d3
commit
143f72a20f
@ -64,15 +64,24 @@ public class DisguiseListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkPlayer(Player entity) {
|
||||
Disguise[] disguises = DisguiseAPI.getDisguises(entity);
|
||||
if (disguises.length > 0) {
|
||||
DisguiseAPI.undisguiseToAll(entity);
|
||||
if (DisguiseConfig.getDisguiseBlownMessage().length() > 0) {
|
||||
entity.sendMessage(DisguiseConfig.getDisguiseBlownMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onAttack(EntityDamageByEntityEvent event) {
|
||||
if (DisguiseConfig.isDisguiseBlownOnAttack() && event.getEntity() instanceof Player) {
|
||||
Disguise[] disguises = DisguiseAPI.getDisguises(event.getEntity());
|
||||
if (disguises.length > 0) {
|
||||
DisguiseAPI.undisguiseToAll(event.getEntity());
|
||||
if (DisguiseConfig.getDisguiseBlownMessage().length() > 0) {
|
||||
((Player) event.getEntity()).sendMessage(DisguiseConfig.getDisguiseBlownMessage());
|
||||
if (DisguiseConfig.isDisguiseBlownOnAttack()) {
|
||||
if (event.getEntity() instanceof Player) {
|
||||
checkPlayer((Player) event.getEntity());
|
||||
}
|
||||
if (event.getDamager() instanceof Player) {
|
||||
checkPlayer((Player) event.getDamager());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user