mirror of
https://github.com/taoneill/war.git
synced 2025-01-23 07:41:21 +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_EXPLODE, entityListener, Priority.Normal, this);
|
||||||
//pm.registerEvent(Event.Type.ENTITY_DEATH, 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.ENTITY_COMBUST, entityListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.CREATURE_SPAWN, 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);
|
pm.registerEvent(Event.Type.ENTITY_REGAIN_HEALTH, entityListener, Priority.Normal, this);
|
||||||
|
@ -165,12 +165,16 @@ public class WarEntityListener extends EntityListener {
|
|||||||
|
|
||||||
public void onEntityDamage(EntityDamageEvent event) {
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
if(war.isLoaded()) {
|
if(war.isLoaded()) {
|
||||||
|
Entity entity = event.getEntity();
|
||||||
|
if(entity instanceof Player && war.getPlayerTeamWarzone(((Player) entity).getName()) != null) {
|
||||||
|
event.setCancelled(false);
|
||||||
|
}
|
||||||
|
|
||||||
if(event instanceof EntityDamageByEntityEvent ||
|
if(event instanceof EntityDamageByEntityEvent ||
|
||||||
event instanceof EntityDamageByProjectileEvent) {
|
event instanceof EntityDamageByProjectileEvent) {
|
||||||
handlerAttackDefend((EntityDamageByEntityEvent)event);
|
handlerAttackDefend((EntityDamageByEntityEvent)event);
|
||||||
} else {
|
} else {
|
||||||
// Detect death (from , prevent it and respawn the player
|
// Detect death (from , prevent it and respawn the player
|
||||||
Entity entity = event.getEntity();
|
|
||||||
if(entity instanceof Player) {
|
if(entity instanceof Player) {
|
||||||
Player player = (Player) entity;
|
Player player = (Player) entity;
|
||||||
Warzone zone = war.getPlayerTeamWarzone(player.getName());
|
Warzone zone = war.getPlayerTeamWarzone(player.getName());
|
||||||
|
Loading…
Reference in New Issue
Block a user