本文整理汇总了Java中org.bukkit.event.entity.EntityDamageEvent.DamageCause.FIRE_TICK属性的典型用法代码示例。如果您正苦于以下问题:Java DamageCause.FIRE_TICK属性的具体用法?Java DamageCause.FIRE_TICK怎么用?Java DamageCause.FIRE_TICK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.event.entity.EntityDamageEvent.DamageCause
的用法示例。
在下文中一共展示了DamageCause.FIRE_TICK属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: monsterDies
@EventHandler(priority = EventPriority.NORMAL)
public void monsterDies(EntityDeathEvent event) {
if (_apocalypseOn && event.getEntity().getLastDamageCause().getCause() != DamageCause.FIRE_TICK) {
if (event.getEntity() instanceof Monster) {
_monsterDead++;
}
if (_monsterDead >= _maxMonsters) {
_completed = true;
distributeLoot();
resetEvent();
}
try {
_spawner.spawnMonsterCloseToPlayer(event.getEntity().getLocation());
}
catch (Exception ex) {
_logger.info("exception raised in Mayhem.monsterDies(EntityDeathEvent event) while using the ApocalypseSpawner");
}
}
}
示例3: onMonsterDamage
@EventHandler(priority = EventPriority.NORMAL)
public void onMonsterDamage(EntityDamageEvent event) {
if (event instanceof EntityDamageByEntityEvent) {
EntityDamageByEntityEvent damageEvent = (EntityDamageByEntityEvent)event;
CustomMonster damager = _damageMonsters.get(damageEvent.getDamager().getEntityId());
if (damager != null && damageEvent.getDamager() instanceof Monster && event.getEntity() instanceof Player) {
int damageDone = (int)(event.getDamage() + (2 * (int)damager.DamageModifier));
//logger.info("damage done is: " + damageDone + " modifier is: " + (int)damager.DamageModifier + " base damage is: " + event.getDamage());
event.setDamage(damageDone);
}
}
CustomMonster noBurn = _noBurnMonsters.get(event.getEntity().getEntityId());
if (noBurn != null && event.getEntity() instanceof Monster && event.getCause() == DamageCause.FIRE_TICK) {
event.setCancelled(true);
event.getEntity().setFireTicks(0);
}
}
示例4: 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);
}
}
}
示例5: onEntityDamage
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityDamage(EntityDamageEvent event) {
if (((event.getCause() == DamageCause.FIRE_TICK) || (event.getCause() == DamageCause.FIRE) || (event.getCause() == DamageCause.DROWNING))) {
for (Player player : ServerPlatform.get().getMiscUtils().getNearbyPlayers(event.getEntity().getLocation(), 48, 128, 48)) {
if (player != null) {
Connection connection = ProtocolSupportAPI.getConnection(player);
if (
(connection != null) &&
(connection.getVersion().getProtocolType() == ProtocolType.PC) &&
connection.getVersion().isBefore(ProtocolVersion.MINECRAFT_1_12)
) {
connection.sendPacket(ServerPlatform.get().getPacketFactory().createEntityStatusPacket(event.getEntity(), 2));
}
}
}
}
}
示例6: onDamage
@EventHandler
public void onDamage(EntityDamageEvent e) {
if (e.getEntity() instanceof Player) {
if (e.getCause() == DamageCause.FIRE || e.getCause() == DamageCause.FIRE_TICK) {
Player p = (Player) e.getEntity();
e.setDamage(e.getDamage() * (1 - EnchantmentZ.calcInventoryPieceAmount(FIRE_PROTECTION, p.getInventory()) * 0.0625));
}
}
}
示例7: onEntityCombustByEntity
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onEntityCombustByEntity (EntityCombustByEntityEvent event)
{
//handle it just like we would an entity damge by entity event, except don't send player messages to avoid double messages
//in cases like attacking with a flame sword or flame arrow, which would ALSO trigger the direct damage event handler
@SuppressWarnings("deprecation")
EntityDamageByEntityEvent eventWrapper = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(), DamageCause.FIRE_TICK, event.getDuration());
this.handleEntityDamageEvent(eventWrapper, false);
event.setCancelled(eventWrapper.isCancelled());
}
示例8: onMonsterDamaged
public void onMonsterDamaged(EntityDamageEvent event) {
Monster monster = null;
for (Monster m : _spawnedMonsters) {
if (m.getEntityId() == event.getEntity().getEntityId()) {
monster = m;
break;
}
}
if (monster != null) {
if (event.getCause() == DamageCause.FIRE_TICK) {
event.setCancelled(true);
event.getEntity().setFireTicks(0);
// lette, hack, shame on me
return;
}
if (!_blockBroken) {
Damageable mDamage = (Damageable)monster;
monster.setHealth(mDamage.getMaxHealth());
//_logger.info("" + monster.getHealth());
}
else {
monster.damage(event.getDamage());
//_logger.info("" + monster.getHealth() + " got damaged!!!");
}
}
}
示例9: onMonsterBurning
@EventHandler(priority = EventPriority.NORMAL)
public void onMonsterBurning(EntityDamageEvent e) {
if (!_config.BurnDuringDaylight && _zone.isInside(e.getEntity().getLocation()) && e.getCause() == DamageCause.FIRE_TICK) {
e.setCancelled(true);
e.getEntity().setFireTicks(0);
}
}
示例10: processDamage
public void processDamage(EntityDamageEvent e) {
if (_scenario.isActive()) {
if (_monstersTable != null && _monstersTable.contains(e.getEntity())) {
if (e.getCause() == DamageCause.FIRE_TICK) {
e.setCancelled(true);
}
}
}
}
示例11: processDamage
@Override
public void processDamage(EntityDamageEvent e) {
if (_scenario.isActive()) {
if (_monsters != null && _monsters.contains(e.getEntity())) {
if (e.getCause() == DamageCause.FIRE_TICK) {
e.setCancelled(true);
}
}
}
}
示例12: 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;
}
}
示例13: onDamage
@EventHandler
public void onDamage(EntityDamageEvent e) {
if (e.getEntity() instanceof Player && e.getCause() == DamageCause.FIRE_TICK) {
if (Zephyrus.getUser((Player) e.getEntity()).isStateApplied(this)) {
}
}
}
示例14: onEntityDamage
/**
* On entity damage.
*
* @param event the event
*/
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityDamage(EntityDamageEvent event) {
// Check for fire cancel
if(event.getEntity() instanceof Player &&
(event.getCause() == DamageCause.FIRE
|| event.getCause() == DamageCause.FIRE_TICK)) {
Player player = (Player) event.getEntity();
IPlayerConfEntry entry = playerConf.get(player);
if(entry != null) {
Location loc = player.getLocation();
IDummyLand land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea(loc);
// Check for fire near the player
for(Map.Entry<Location, IPlayerContainerPlayer> fireEntry : playerFireLocation.entrySet()) {
if(loc.getWorld() == fireEntry.getKey().getWorld()
&& loc.distanceSquared(fireEntry.getKey()) < 5) {
Block block = loc.getBlock();
if((block.getType() == Material.FIRE || block.getType() == Material.AIR)
&& !isPvpValid(land, fireEntry.getValue(), entry.getPlayerContainer())) {
// remove fire
Factoid.getThisPlugin().iLog().write("Anti-pvp from "
+ entry.getPlayerContainer().getPlayer().getName()
+ " to " + player.getName());
block.setType(Material.AIR);
player.setFireTicks(0);
event.setDamage(0);
event.setCancelled(true);
}
}
}
}
}
}
示例15: 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);
}
}
}