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


Java DamageCause.VOID属性代码示例

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


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

示例1: onPlayerDamage

@EventHandler
public void onPlayerDamage(EntityDamageEvent event) {
	if (!(event.getEntity() instanceof Player))
		return;
	event.setCancelled(true);
	
	if (event.getCause()==DamageCause.VOID) {
		Location l = event.getEntity().getWorld().getSpawnLocation();
		l.setX(14.5);
		l.setY(10.5);
		l.setZ(-795.5);
		l.setPitch(0.5F);
		l.setYaw(90 * RandomUtil.between(1, 4));
		event.getEntity().teleport(l);
	}
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:16,代码来源:Events.java

示例2: onCancell

@EventHandler
public void onCancell(EntityDamageEvent event){
Entity e = event.getEntity();
if(!(e instanceof Player)){
	return;
}
Player p = (Player)e;
Arena a = new ArenaManager().getArena(p);

if(a==null){
	event.setCancelled(true);
	return;
}
if(a.isEnd()){
	event.setCancelled(true);
	
}
if(a.fallMode()==true){
	if(event.getCause() == DamageCause.FALL||event.getCause() == DamageCause.VOID){
	event.setCancelled(true);
	}
}
}
 
开发者ID:SpikyBite,项目名称:BiteSkywars,代码行数:23,代码来源:PlayerListener.java

示例3: onHit

@EventHandler
public void onHit(EntityDamageEvent event) {
    if (event.getEntity() instanceof IronGolem) {
        final IronGolem g = (IronGolem) event.getEntity();
        if (g.getCustomName() == null)
            return;

        final Boss b = plugin.getBossManager().bossNames.get(g
                .getCustomName());
        if (b == null)
            return;

        if (event.getCause() == DamageCause.VOID) {
            event.getEntity().remove();

            Bukkit.getScheduler().runTask(plugin, new Runnable() {
                public void run() {
                    Boss n = plugin.getBossManager().newBoss(b);
                    plugin.getBossManager().spawn(n);
                }
            });
            return;
        }
    }
}
 
开发者ID:cancabron,项目名称:Annihilation,代码行数:25,代码来源:BossListener.java

示例4: onHit

@EventHandler
public void onHit(EntityDamageEvent event) {
    if (event.getEntity() instanceof IronGolem) {
        final IronGolem g = (IronGolem) event.getEntity();
        if (g.getCustomName() == null)
            return;

        final Golem b = plugin.getBossManager().bossNames.get(g
                .getCustomName());
        if (b == null)
            return;

        if (event.getCause() == DamageCause.VOID) {
            event.getEntity().remove();

            Bukkit.getScheduler().runTask(plugin, new Runnable() {
                @Override
                public void run() {
                    Golem n = plugin.getBossManager().newBoss(b);
                    plugin.getBossManager().spawn(n);
                }
            });
        }
    }
}
 
开发者ID:MCTyler,项目名称:CrafterNexus,代码行数:25,代码来源:GolemListener.java

示例5: resolve

public @Nullable
DamageInfo resolve(@Nonnull LivingEntity entity, @Nonnull Lifetime lifetime, @Nonnull EntityDamageEvent damageEvent) {
    if(damageEvent.getCause() == DamageCause.VOID) {
        return new SimpleVoidDamageInfo(null);
    }

    return null;
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:8,代码来源:VoidDamageResolver.java

示例6: onEntityDamageEvent

@EventHandler
public void onEntityDamageEvent(EntityDamageEvent event) {
    if (event.getCause() == DamageCause.VOID && event.getEntity() instanceof Player) {
        if (lastVoid.containsKey(((Player) event.getEntity()).getName()) && System.currentTimeMillis() - lastVoid.get(((Player) event.getEntity()).getName()) < 5000)
            return;
        ((Player) event.getEntity()).sendMessage(ChatColor.RED + "Woah! Careful there, pal!");
        event.getEntity().setFallDistance(0);
        event.getEntity().teleport(event.getEntity().getWorld().getSpawnLocation());
        event.getEntity().setFallDistance(0);
    } else if (event.getCause() == DamageCause.VOID && MobManager.spawnedMobs.get(event.getEntity().getUniqueId()) != null) {
        MobData md = MobManager.spawnedMobs.get(event.getEntity().getUniqueId());
        event.getEntity().teleport(md.ai.originalLoc);
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:14,代码来源:EnvironmentManager.java

示例7: onEntityDamage

@EventHandler
public void onEntityDamage(EntityDamageEvent event) {
	if (!(event.getEntity() instanceof Player))
		return;
	
	if (event.getCause() != DamageCause.VOID)
		return;
	
	Player p = (Player) event.getEntity();
	Gamer g = Gamer.get(p);
	if (g.getVariable("parkour") != null) {
		p.teleport(((Course) g.getVariable("parkour")).getStart());
	}
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:14,代码来源:Parkour.java

示例8: 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

示例9: onDamage

@EventHandler
public void onDamage(EntityDamageEvent e) {
	if (e.getEntity() instanceof Player && e.getCause() != null && e.getCause() != DamageCause.VOID) {
		if (Zephyrus.getUser(((Player) e.getEntity()).getName()).isStateApplied(this)) {
			e.setDamage(e.getDamage() / 4D);
		}
	}
}
 
开发者ID:mcardy,项目名称:Zephyrus-II,代码行数:8,代码来源:ArmorState.java

示例10: handle

@EventHandler
public void handle(EntityDamageEvent event) {
    if (Mgr.INSTANCE.isPortalVoid() && event.getEntityType() == EntityType.PLAYER && event.getCause() == DamageCause.VOID) {
        event.setCancelled(true);
        portal(Player.class.cast(event.getEntity()));
    }
}
 
开发者ID:caoli5288,项目名称:LoginTeleport,代码行数:7,代码来源:Executor.java

示例11: onPlayerDamage

@EventHandler
public void onPlayerDamage(EntityDamageEvent e) {
    if (e.getEntity() instanceof Player) {
        if (e.getEntity().getWorld().getName().equals("lobby")) {
            e.setCancelled(true);

            if (e.getCause() == DamageCause.VOID)
                e.getEntity().teleport(
                        plugin.getMapManager().getLobbySpawnPoint());
        }
    }
}
 
开发者ID:cancabron,项目名称:Annihilation,代码行数:12,代码来源:PlayerListener.java

示例12: onEntityDamage

@EventHandler
public void onEntityDamage(EntityDamageEvent event) {
    if (event.getEntity() instanceof Player) {
        if (event.getCause() == DamageCause.LAVA || event.getCause() == DamageCause.FIRE || event.getCause() == DamageCause.FIRE_TICK) {
            event.getEntity().setFireTicks(0);
        }
        if (event.getCause() != DamageCause.VOID) {
            event.setCancelled(true);
        }
    }
}
 
开发者ID:EyeOfEnder-Ltd,项目名称:EOEHub,代码行数:11,代码来源:PlayerListener.java

示例13: onEntityDamage

@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onEntityDamage(EntityDamageEvent e)
{
	if (e.getEntity() instanceof Player && game.isPlaying((Player)e.getEntity()))
	{
		if (!game.isRunning && e.getCause() == DamageCause.VOID)
		{
			Challenger c = game.getPlayer((Player)e.getEntity());
			c.teleport(game.getRegion().getSpawn(c.getTeam()));
		}
		
		e.setCancelled(!isAllowedAction((Player)e.getEntity()));
	}
}
 
开发者ID:riking,项目名称:GrandVide,代码行数:14,代码来源:Events.java

示例14: onDamage

@EventHandler
public void onDamage(EntityDamageEvent e) {
	try {
		if (e.getEntity() instanceof Player && e.getCause() != DamageCause.VOID) {
			Player player = (Player) e.getEntity();
			if (EffectHandler.hasEffect(player, EffectType.ARMOUR)) {
				e.setDamage(e.getDamage() / 4.0F);
			}
		}
	} catch (Exception ex) {
	}
}
 
开发者ID:mcardy,项目名称:Zephyrus,代码行数:12,代码来源:ArmourEffect.java

示例15: damageEntity

@Override
public boolean damageEntity(DamageSource source, float damage) {
    if (invulnerable || noDamageTicks > 0) {
        return false;
    }

    DamageCause cause = null;
    org.bukkit.entity.Entity bEntity = null;
    if (source instanceof EntityDamageSource) {
        Entity damager = source.getEntity();
        cause = DamageCause.ENTITY_ATTACK;
        if (source instanceof EntityDamageSourceIndirect) {
            damager = ((EntityDamageSourceIndirect) source).getProximateDamageSource();
            if (damager.getBukkitEntity() instanceof ThrownPotion) {
                cause = DamageCause.MAGIC;
            } else if (damager.getBukkitEntity() instanceof Projectile) {
                cause = DamageCause.PROJECTILE;
            }
        }

        bEntity = damager.getBukkitEntity();
    } else if (source == DamageSource.FIRE)
        cause = DamageCause.FIRE;
    else if (source == DamageSource.STARVE)
        cause = DamageCause.STARVATION;
    else if (source == DamageSource.WITHER)
        cause = DamageCause.WITHER;
    else if (source == DamageSource.STUCK)
        cause = DamageCause.SUFFOCATION;
    else if (source == DamageSource.DROWN)
        cause = DamageCause.DROWNING;
    else if (source == DamageSource.BURN)
        cause = DamageCause.FIRE_TICK;
    else if (source == CraftEventFactory.MELTING)
        cause = DamageCause.MELTING;
    else if (source == CraftEventFactory.POISON)
        cause = DamageCause.POISON;
    else if (source == DamageSource.MAGIC) {
        cause = DamageCause.MAGIC;
    } else if (source == DamageSource.OUT_OF_WORLD) {
        cause = DamageCause.VOID;
    }

    if (cause != null) {
        NPCDamageEvent event = new NPCDamageEvent(npc, bEntity, cause, (double) damage);
        Bukkit.getPluginManager().callEvent(event);
        if (!event.isCancelled()) {
            return super.damageEntity(source, (float) event.getDamage());
        } else {
            return false;
        }
    }

    if (super.damageEntity(source, damage)) {
        if (bEntity != null) {
            Entity e = ((CraftEntity) bEntity).getHandle();
            double d0 = e.locX - this.locX;

            double d1;
            for (d1 = e.locZ - this.locZ; d0 * d0 + d1 * d1 < 0.0001D; d1 = (Math.random() - Math.random()) * 0.01D) {
                d0 = (Math.random() - Math.random()) * 0.01D;
            }

            a(e, damage, d0, d1);
        }

        return true;
    } else {
        return false;
    }
}
 
开发者ID:johnnywoof,项目名称:NoHack,代码行数:71,代码来源:NPCEntity.java


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