本文整理汇总了Java中org.bukkit.event.entity.EntityDamageEvent.DamageCause.LAVA属性的典型用法代码示例。如果您正苦于以下问题:Java DamageCause.LAVA属性的具体用法?Java DamageCause.LAVA怎么用?Java DamageCause.LAVA使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.event.entity.EntityDamageEvent.DamageCause
的用法示例。
在下文中一共展示了DamageCause.LAVA属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemDamage
@EventHandler
public void onItemDamage(EntityDamageEvent event) {
if (event.getEntityType() == EntityType.DROPPED_ITEM && (event.getCause() == DamageCause.LAVA || event.getCause() == DamageCause.FIRE_TICK || event.getCause() == DamageCause.FIRE)) {
Vector v = Vector.getRandom().normalize();
v = v.setX(v.getX() - 0.5f);
v = v.setZ(v.getZ() - 0.5f);
v = v.multiply(0.35);
if (v.getX() > 0 && v.getX() < 0.10)
v.setX(0.10);
if (v.getZ() > 0 && v.getZ() < 0.10)
v.setZ(0.10);
if (v.getX() < 0 && v.getX() > -0.10)
v.setX(-0.10);
if (v.getZ() < 0 && v.getZ() > -0.10)
v.setZ(-0.10);
v.setY(0.3);
event.getEntity().setVelocity(v);
event.setCancelled(true);
RScheduler.schedule(plugin, () -> {
event.getEntity().setFireTicks(0);
}, RTicks.seconds(1));
}
if (event.getEntityType() == EntityType.ARMOR_STAND && (event.getCause() == DamageCause.LAVA || event.getCause() == DamageCause.FIRE_TICK || event.getCause() == DamageCause.FIRE)) {
event.setCancelled(true);
}
}
示例2: onEntityDamage
@EventHandler
public void onEntityDamage(final EntityDamageEvent event) {
if (event.getCause() == DamageCause.DROWNING || event.getCause() == DamageCause.SUFFOCATION || event.getCause() == DamageCause.FIRE || event.getCause() == DamageCause.FIRE_TICK || event.getCause() == DamageCause.LAVA) {
// Ok so an entity damage event begins
// Find the nearest gate!
final WorldCoord entityCoord = new WorldCoord(event.getEntity().getLocation());
final WorldCoord entityCoordUp = new WorldCoord(event.getEntity().getLocation().getBlock().getRelative(BlockFace.UP));
final Gate nearestGate = GateUtil.nearestGate(entityCoord, false);
final Gate nearestGateUp = GateUtil.nearestGate(entityCoordUp, false);
if (nearestGate != null || nearestGateUp != null) {
event.setCancelled(true);
event.getEntity().setFireTicks(0);
}
}
}
示例3: onEntityDamage
@EventHandler(priority = EventPriority.MONITOR)
public void onEntityDamage(EntityDamageEvent event)
{
if (event.isCancelled() || event.getDamage() <= 0.0D)
return;
if (! bloodEffectEnabled || bloodEffectGunsOnly || bloodEffectType == null)
return;
Entity entity = event.getEntity();
if (event.getEntity() instanceof LivingEntity)
{
if (entity instanceof Player)
{
if (((Player) entity).getGameMode() == GameMode.CREATIVE)
return;
}
if (event.getCause() != DamageCause.DROWNING && event.getCause() != DamageCause.LAVA)
{
World world = entity.getWorld();
world.playEffect(entity.getLocation(), Effect.STEP_SOUND, bloodEffectType);
world.playEffect(entity.getLocation().add(0, 1, 0), Effect.STEP_SOUND, bloodEffectType);
}
}
}
示例4: resolve
public @Nullable
DamageInfo resolve(@Nonnull LivingEntity entity, @Nonnull Lifetime lifetime, @Nonnull EntityDamageEvent damageEvent) {
if(damageEvent.getCause() == DamageCause.LAVA) {
return new SimpleLavaDamageInfo(null);
}
return null;
}
示例5: onDamageGet
@EventHandler(priority=EventPriority.MONITOR)
public void onDamageGet(EntityDamageEvent e) {
if (!e.isCancelled()) {
if (e instanceof EntityDamageByEntityEvent) {
if (((EntityDamageByEntityEvent) e).getDamager() instanceof Player && SlimefunStartup.chance(100, 45)) {
if (SlimefunManager.isItemSimiliar(((Player) ((EntityDamageByEntityEvent) e).getDamager()).getInventory().getItemInMainHand(), SlimefunItem.getItem("BLADE_OF_VAMPIRES"), true)) {
((Player) ((EntityDamageByEntityEvent) e).getDamager()).playSound(((EntityDamageByEntityEvent) e).getDamager().getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 0.7F, 0.7F);
((Player) ((EntityDamageByEntityEvent) e).getDamager()).addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1, 1));
}
}
}
if (e.getEntity() instanceof Player) {
if (!e.isCancelled()) {
if (e.getCause() == DamageCause.LAVA) Talisman.checkFor(e, SlimefunItem.getByID("LAVA_TALISMAN"));
if (e.getCause() == DamageCause.DROWNING) Talisman.checkFor(e, SlimefunItem.getByID("WATER_TALISMAN"));
if (e.getCause() == DamageCause.FALL) Talisman.checkFor(e, SlimefunItem.getByID("ANGEL_TALISMAN"));
if (e.getCause() == DamageCause.FIRE) Talisman.checkFor(e, SlimefunItem.getByID("FIRE_TALISMAN"));
if (e.getCause() == DamageCause.ENTITY_ATTACK) Talisman.checkFor(e, SlimefunItem.getByID("WARRIOR_TALISMAN"));
if (e.getCause() == DamageCause.ENTITY_ATTACK) Talisman.checkFor(e, SlimefunItem.getByID("KNIGHT_TALISMAN"));
if (e.getCause() == DamageCause.PROJECTILE) {
if (Talisman.checkFor(e, SlimefunItem.getByID("WHIRLWIND_TALISMAN"))) {
if (((EntityDamageByEntityEvent) e).getDamager() instanceof Projectile) {
Vector direction = ((Player) e.getEntity()).getEyeLocation().getDirection().multiply(2.0);
Projectile projectile = (Projectile) e.getEntity().getWorld().spawnEntity(((LivingEntity) e.getEntity()).getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), ((EntityDamageByEntityEvent) e).getDamager().getType());
projectile.setVelocity(direction);
((EntityDamageByEntityEvent) e).getDamager().remove();
}
}
}
}
}
}
}
示例6: getBlockDamageCause
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;
}
}
示例7: 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;
}
}
示例8: 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);
}
}
}