org.bukkit.event.entity.EntityDamageEvent.DamageCause#CONTACT源码实例Demo

下面列出了org.bukkit.event.entity.EntityDamageEvent.DamageCause#CONTACT 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Modern-LWC   文件: LWCPlayerListener.java
@EventHandler
public void onEntityDamage(EntityDamageEvent e) {
    if (e instanceof EntityDamageByEntityEvent
            && !(e.getCause() == DamageCause.BLOCK_EXPLOSION || e.getCause() == DamageCause.ENTITY_EXPLOSION))
        return;
    Entity entity = e.getEntity();
    if (plugin.getLWC().isProtectable(e.getEntity().getType())) {
        int A = 50000 + entity.getUniqueId().hashCode();
        LWC lwc = LWC.getInstance();
        Protection protection = lwc.getPhysicalDatabase().loadProtection(entity.getWorld().getName(), A, A, A);
        if (protection != null) {
            if (e.getCause() != DamageCause.CONTACT)
                e.setCancelled(true);
        }
    }
}
 
源代码2 项目: PGM   文件: DisableDamageMatchModule.java
private static DamageCause getBlockDamageCause(Block block) {
  switch (block.getType()) {
    case LAVA:
    case STATIONARY_LAVA:
      return DamageCause.LAVA;

    case FIRE:
      return DamageCause.FIRE;

    default:
      return DamageCause.CONTACT;
  }
}
 
源代码3 项目: ProjectAres   文件: DisableDamageMatchModule.java
private static DamageCause getBlockDamageCause(Block block) {
    switch(block.getType()) {
        case LAVA:
        case STATIONARY_LAVA:
            return DamageCause.LAVA;

        case FIRE:
            return DamageCause.FIRE;

        default:
            return DamageCause.CONTACT;
    }
}