mirror of
https://github.com/taoneill/war.git
synced 2025-01-05 23:37:37 +01:00
Uncancels damage event first (Disabling of /god)
This commit is contained in:
parent
6c0212d405
commit
bd6d02ba76
@ -143,7 +143,7 @@ public class War extends JavaPlugin {
|
||||
|
||||
pm.registerEvent(Event.Type.ENTITY_EXPLODE, entityListener, Priority.Normal, this);
|
||||
//pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Priority.High, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_COMBUST, entityListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.CREATURE_SPAWN, entityListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_REGAIN_HEALTH, entityListener, Priority.Normal, this);
|
||||
@ -1618,4 +1618,4 @@ public class War extends JavaPlugin {
|
||||
public boolean isLoaded() {
|
||||
return loaded;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -165,12 +165,16 @@ public class WarEntityListener extends EntityListener {
|
||||
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
if(war.isLoaded()) {
|
||||
Entity entity = event.getEntity();
|
||||
if(entity instanceof Player && war.getPlayerTeamWarzone(((Player) entity).getName()) != null) {
|
||||
event.setCancelled(false);
|
||||
}
|
||||
|
||||
if(event instanceof EntityDamageByEntityEvent ||
|
||||
event instanceof EntityDamageByProjectileEvent) {
|
||||
handlerAttackDefend((EntityDamageByEntityEvent)event);
|
||||
} else {
|
||||
// Detect death (from , prevent it and respawn the player
|
||||
Entity entity = event.getEntity();
|
||||
if(entity instanceof Player) {
|
||||
Player player = (Player) entity;
|
||||
Warzone zone = war.getPlayerTeamWarzone(player.getName());
|
||||
|
Loading…
Reference in New Issue
Block a user