当前位置: 首页>>代码示例>>Java>>正文


Java DamageCause.ENTITY_EXPLOSION属性代码示例

本文整理汇总了Java中org.bukkit.event.entity.EntityDamageEvent.DamageCause.ENTITY_EXPLOSION属性的典型用法代码示例。如果您正苦于以下问题:Java DamageCause.ENTITY_EXPLOSION属性的具体用法?Java DamageCause.ENTITY_EXPLOSION怎么用?Java DamageCause.ENTITY_EXPLOSION使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.bukkit.event.entity.EntityDamageEvent.DamageCause的用法示例。


在下文中一共展示了DamageCause.ENTITY_EXPLOSION属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onEntityDamage

@EventHandler
public void onEntityDamage(EntityDamageEvent event) {
    if (damageTypes.contains(event.getCause()) && (event.getCause() != DamageCause.BLOCK_EXPLOSION || event.getCause() != DamageCause.ENTITY_EXPLOSION)) {
        event.setCancelled(true);
    } else if (event.getCause() == DamageCause.BLOCK_EXPLOSION || event.getCause() == DamageCause.ENTITY_EXPLOSION) {
        if (event instanceof EntityDamageByEntityEvent) {
            if (event.getEntity() instanceof Player && TntTracker.getWhoPlaced(((EntityDamageByEntityEvent) event).getDamager()) != null) {
                Player player = (Player) event.getEntity();
                UUID source = TntTracker.getWhoPlaced(((EntityDamageByEntityEvent) event).getDamager());
                Match match = GameHandler.getGameHandler().getMatch();
                if (Bukkit.getOfflinePlayer(source).isOnline()) {
                    if (Bukkit.getPlayer(source).equals(player)) {
                        event.setCancelled(!blockExplosionSelf);
                    } else if (TeamUtils.getTeamByPlayer(Bukkit.getPlayer(source)) == TeamUtils.getTeamByPlayer(player)) {
                        event.setCancelled(!blockExplosionAlly);
                    } else if (TeamUtils.getTeamByPlayer(Bukkit.getPlayer(source)) != TeamUtils.getTeamByPlayer(player)) {
                        event.setCancelled(!blockExplosionEnemy);
                    } else {
                        event.setCancelled(!blockExplosionOther);
                    }
                }
            }
        } else if (damageTypes.contains(DamageCause.BLOCK_EXPLOSION)) event.setCancelled(true);
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:25,代码来源:DisableDamage.java

示例2: onEntityDamage

@EventHandler
public void onEntityDamage(EntityDamageEvent event) {
    if (damageTypes.contains(event.getCause()) && (event.getCause() != DamageCause.BLOCK_EXPLOSION || event.getCause() != DamageCause.ENTITY_EXPLOSION)) {
        event.setCancelled(true);
    } else if (event.getCause() == DamageCause.BLOCK_EXPLOSION || event.getCause() == DamageCause.ENTITY_EXPLOSION) {
        if (event instanceof EntityDamageByEntityEvent) {
            if (event.getEntity() instanceof Player && TntTracker.getWhoPlaced(((EntityDamageByEntityEvent) event).getDamager()) != null) {
                Player player = (Player) event.getEntity();
                UUID source = TntTracker.getWhoPlaced(((EntityDamageByEntityEvent) event).getDamager());
                Match match = GameHandler.getGameHandler().getMatch();
                if (Bukkit.getOfflinePlayer(source).isOnline()) {
                    if (Bukkit.getPlayer(source).equals(player)) {
                        event.setCancelled(!blockExplosionSelf);
                    } else if (Teams.getTeamByPlayer(Bukkit.getPlayer(source)) == Teams.getTeamByPlayer(player)) {
                        event.setCancelled(!blockExplosionAlly);
                    } else if (Teams.getTeamByPlayer(Bukkit.getPlayer(source)) != Teams.getTeamByPlayer(player)) {
                        event.setCancelled(!blockExplosionEnemy);
                    } else {
                        event.setCancelled(!blockExplosionOther);
                    }
                }
            }
        } else if (damageTypes.contains(DamageCause.BLOCK_EXPLOSION)) event.setCancelled(true);
    }
}
 
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:25,代码来源:DisableDamage.java

示例3: IsEnviromentKill

private boolean IsEnviromentKill(DamageCause damageCause)
{
	boolean env = this.model.getConfig().getZombieSpawnCondition().getEnv();

	if(env)
	{
		if(damageCause == DamageCause.ENTITY_ATTACK || damageCause == DamageCause.ENTITY_EXPLOSION)
		{
			return false;
		}

		return true;
	}

	return false;
}
 
开发者ID:DreanorBukkit,项目名称:ZombieResurrection,代码行数:16,代码来源:EntityDeathListener.java

示例4: onDamage

@EventHandler
public void onDamage(EntityDamageEvent e) {
	if (e.getEntity() instanceof Player) {
		if (e.getCause() == DamageCause.BLOCK_EXPLOSION || e.getCause() == DamageCause.ENTITY_EXPLOSION) {
			Player p = (Player) e.getEntity();
			e.setDamage(e.getDamage() * (1 - EnchantmentZ.calcInventoryPieceAmount(BLAST_PROTECTION, p.getInventory()) * 0.0625));
		}
	}
}
 
开发者ID:crazyhorse961,项目名称:NationZ,代码行数:9,代码来源:EnchantmentZ_BlastProtection.java

示例5: toBukkit

public static DamageCause toBukkit(cn.nukkit.event.entity.EntityDamageEvent.DamageCause nukkit) {
	// TODO Direct mapping via DamageCause.valueOf?
	switch (nukkit) {
		case CONTACT:
			return DamageCause.CONTACT;
		case ENTITY_ATTACK:
			return DamageCause.ENTITY_ATTACK;
		case PROJECTILE:
			return DamageCause.PROJECTILE;
		case SUFFOCATION:
			return DamageCause.SUFFOCATION;
		case FALL:
			return DamageCause.FALL;
		case FIRE:
			return DamageCause.FIRE;
		case FIRE_TICK:
			return DamageCause.FIRE_TICK;
		case LAVA:
			return DamageCause.LAVA;
		case DROWNING:
			return DamageCause.DROWNING;
		case BLOCK_EXPLOSION:
			return DamageCause.BLOCK_EXPLOSION;
		case ENTITY_EXPLOSION:
			return DamageCause.ENTITY_EXPLOSION;
		case VOID:
			return DamageCause.VOID;
		case SUICIDE:
			return DamageCause.SUICIDE;
		case MAGIC:
			return DamageCause.MAGIC;
		case LIGHTNING:
			return DamageCause.LIGHTNING;
		case CUSTOM:
		default:
			return DamageCause.CUSTOM;
	}
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:38,代码来源:PokkitDamageCause.java

示例6: onEntityDamage

/**
 * On entity damage.
 *
 * @param event the event
 */
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityDamage(EntityDamageEvent event) {

    if (conf.isOverrideExplosions()
            && event.getEntity() instanceof Hanging
            && (event.getCause() == DamageCause.BLOCK_EXPLOSION || event.getCause() == DamageCause.ENTITY_EXPLOSION
            || event.getCause() == DamageCause.PROJECTILE)) {
        // Check for ItemFrame
        Factoid.getThisPlugin().iLog().write("Cancel HangingBreak : " + event.getEntity() + ", Cause: " + event.getCause());
        event.setCancelled(true);
    }
}
 
开发者ID:Tabinol,项目名称:Factoid,代码行数:17,代码来源:WorldListener.java

示例7: onEntityDamage

@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityDamage(final ExtendedEntityDamageEvent ext) {
    final EntityDamageEvent event = (EntityDamageEvent)ext.getBaseEvent();
    if (event.getCause() == DamageCause.ENTITY_EXPLOSION) {
        if (event.getEntityType() == EntityType.DROPPED_ITEM) {
            if (ext.getEntityRegion() != null && ext.getEntityRegion().getFlag(Flag.EXPLOSION_ITEM) || ext.getDamagerRegion() != null && ext.getDamagerRegion().getFlag(Flag.EXPLOSION_ITEM)) {
                event.setCancelled(true);
            }
        } else if (event.getEntityType() == EntityType.PLAYER) {
            if (ext.getEntityRegion() != null && ext.getEntityRegion().getFlag(Flag.EXPLOSION_PLAYER) || ext.getDamagerRegion() != null && ext.getDamagerRegion().getFlag(Flag.EXPLOSION_PLAYER)) {
                event.setCancelled(true);
            }
        }
    }
}
 
开发者ID:Ribesg,项目名称:NPlugins,代码行数:15,代码来源:ExplosionFlagListener.java

示例8: IsPvEKill

private boolean IsPvEKill(DamageCause damageCause)
{
	boolean pve = this.model.getConfig().getZombieSpawnCondition().getPvE();

	if(pve)
	{
		if(damageCause == DamageCause.ENTITY_ATTACK || damageCause == DamageCause.ENTITY_EXPLOSION || damageCause == DamageCause.PROJECTILE)
		{
			return true;
		}
	}

	return false;
}
 
开发者ID:DreanorBukkit,项目名称:ZombieResurrection,代码行数:14,代码来源:EntityDeathListener.java

示例9: onSteveHurt

@EventHandler
public void onSteveHurt(EntityDamageEvent e) {
	if(e.getEntity() instanceof Player) {
		Player p = (Player) e.getEntity();
		//p.getWorld().playSound(p.getLocation(), Sound.HURT, 1, 1);
		if(e.getCause() == DamageCause.BLOCK_EXPLOSION) {
			p.getWorld().playSound(p.getLocation(), Sound.HURT, 1, 1);
			return;
		} else if(e.getCause() == DamageCause.DROWNING) {
			p.getWorld().playSound(p.getLocation(), Sound.HURT, 1, 1);
			return;
		} else if(e.getCause() == DamageCause.ENTITY_ATTACK) {
			p.getWorld().playSound(p.getLocation(), Sound.HURT, 1, 1);
			return;
		} else if(e.getCause() == DamageCause.ENTITY_EXPLOSION) {
			p.getWorld().playSound(p.getLocation(), Sound.HURT, 1, 1);
			return;
		} else if(e.getCause() == DamageCause.FALL) {
			p.getWorld().playSound(p.getLocation(), Sound.HURT, 1, 1);
			return;
		} else if(e.getCause() == DamageCause.FALLING_BLOCK) {
			p.getWorld().playSound(p.getLocation(), Sound.HURT, 1, 1);
			return;
		} else if(e.getCause() == DamageCause.FIRE_TICK) {
			p.getWorld().playSound(p.getLocation(), Sound.HURT, 1, 1);
			return;
		} else if(e.getCause() == DamageCause.LIGHTNING) {
			p.getWorld().playSound(p.getLocation(), Sound.HURT, 1, 1);
			return;
		} else if(e.getCause() == DamageCause.MELTING) {
			p.getWorld().playSound(p.getLocation(), Sound.HURT, 1, 1);
			return;
		} else if(e.getCause() == DamageCause.POISON) {
			p.getWorld().playSound(p.getLocation(), Sound.HURT, 1, 1);
			return;
		} else if(e.getCause() == DamageCause.PROJECTILE) {
			p.getWorld().playSound(p.getLocation(), Sound.HURT, 1, 1);
			return;
		} else if(e.getCause() == DamageCause.STARVATION) {
			p.getWorld().playSound(p.getLocation(), Sound.HURT, 1, 1);
			return;
		} else if(e.getCause() == DamageCause.SUFFOCATION) {
			p.getWorld().playSound(p.getLocation(), Sound.HURT, 1, 1);
			return;
		} else if(e.getCause() == DamageCause.SUICIDE) {
			p.getWorld().playSound(p.getLocation(), Sound.HURT, 1, 1);
			return;
		} else if(e.getCause() == DamageCause.THORNS) {
			p.getWorld().playSound(p.getLocation(), Sound.HURT, 1, 1);
			return;
		} else if(e.getCause() == DamageCause.VOID) {
			p.getWorld().playSound(p.getLocation(), Sound.HURT, 1, 1);
			return;
		} else if(e.getCause() == DamageCause.WITHER) {
			p.getWorld().playSound(p.getLocation(), Sound.HURT, 1, 1);
			return;
		}
	}
}
 
开发者ID:xize,项目名称:xEssentials_old_Source,代码行数:59,代码来源:steveHurtSound.java


注:本文中的org.bukkit.event.entity.EntityDamageEvent.DamageCause.ENTITY_EXPLOSION属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。